Class IndexedPackage<C>

java.lang.Object
ch.nolix.base.net.messaging.IndexedPackage<C>
Type Parameters:
C - is the type of the content of a IndexedPackage.

public class IndexedPackage<C> extends Object
A IndexedPackage bundles an index and a content.
Author:
Silvan Wyss
  • Method Details

    • withIndexAndContent

      public static <C2> IndexedPackage<C2> withIndexAndContent(int index, C2 content)
      Type Parameters:
      C2 - is the type of the given content.
      Parameters:
      index -
      content -
      Returns:
      a new IndexedPackage with the given index and content.
      Throws:
      RuntimeException - if the given content is null.
    • getStoredContent

      public final C getStoredContent()
      Returns:
      the content of the current IndexedPackage.
    • getIndex

      public final int getIndex()
      Returns:
      the index of the current IndexedPackage.
    • hasIndex

      public final boolean hasIndex(int index)
      Parameters:
      index -
      Returns:
      true if the current IndexedPackage has the given index, false otherwise.