Klasse PairList<LeftT,RightT>

java.lang.Object
java.util.AbstractCollection<Pair<LeftT,RightT>>
java.util.AbstractList<Pair<LeftT,RightT>>
java.util.AbstractSequentialList<Pair<LeftT,RightT>>
java.util.LinkedList<Pair<LeftT,RightT>>
de.kamillionlabs.hateoflux.utility.pair.PairList<LeftT,RightT>
Typparameter:
LeftT - the type of the left elements in the pairs
RightT - the type of the right elements in the pairs
Alle implementierten Schnittstellen:
Serializable, Cloneable, Iterable<Pair<LeftT,RightT>>, Collection<Pair<LeftT,RightT>>, Deque<Pair<LeftT,RightT>>, List<Pair<LeftT,RightT>>, Queue<Pair<LeftT,RightT>>, SequencedCollection<Pair<LeftT,RightT>>

public class PairList<LeftT,RightT> extends LinkedList<Pair<LeftT,RightT>>
A specialized list implementation that stores pairs of values.

Ordered collection of Pair objects, where each pair consists of a left element of type LeftT and a right element of type RightT.

Use PairList when you need to manage an ordered sequence of related pairs without the constraints of key-based collections like maps. This is particularly useful for scenarios where duplicate left elements are permissible or when the relationship between elements doesn't fit a key-value paradigm.

Siehe auch:
  • Methodendetails

    • toPairFlux

      public PairFlux<LeftT,RightT> toPairFlux()
      Converts this PairList instance to a PairFlux instance, allowing the pairs in this list to be used in a reactive stream.

      This method creates a new PairFlux that emits each pair contained in this PairList.

      Gibt zurück:
      a PairFlux instance containing the same pairs as this PairList
    • add

      public boolean add(LeftT left, RightT right)
      Adds a new pair to the list.
      Parameter:
      left - the left element of the pair
      right - the right element of the pair
      Gibt zurück:
      true (as specified by Collection.add(E))
    • getLeft

      public LeftT getLeft(int i)
      Retrieves the left element of the pair at the specified index.
      Parameter:
      i - the index of the pair
      Gibt zurück:
      the left element of the pair at the specified index
    • getRight

      public RightT getRight(int i)
      Retrieves the right element of the pair at the specified index.
      Parameter:
      i - the index of the pair
      Gibt zurück:
      the right element of the pair at the specified index
    • getLefts

      public List<LeftT> getLefts()
      Returns a list of all left elements in the pairs.
      Gibt zurück:
      a list containing all left elements
    • getRights

      public List<RightT> getRights()
      Returns a list of all right elements in the pairs.
      Gibt zurück:
      a list containing all right elements
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of()
      Creates an empty PairList.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Gibt zurück:
      a new empty PairList
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(List<Pair<LeftT,RightT>> pairs)
      Creates a PairList from a list of pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      pairs - the list of pairs
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(List<LeftT> lefts, List<RightT> rights)
      Creates a PairList from two lists of left and right elements.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      lefts - the list of left elements
      rights - the list of right elements
      Gibt zurück:
      a new PairList containing pairs formed from the given lists
      Löst aus:
      IllegalArgumentException - if the lists are null or of different sizes
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(Map<LeftT,RightT> pairs)
      Creates a PairList from a map of left and right elements.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      pairs - the map containing pairs of left and right elements
      Gibt zurück:
      a new PairList containing pairs from the map
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1)
      Creates a PairList with a single pair.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      Gibt zurück:
      a new PairList containing the specified pair
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2)
      Creates a PairList with two pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3)
      Creates a PairList with three pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4)
      Creates a PairList with four pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5)
      Creates a PairList with five pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5, LeftT l6, RightT r6)
      Creates a PairList with six pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      l6 - the left element of the sixth pair
      r6 - the right element of the sixth pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5, LeftT l6, RightT r6, LeftT l7, RightT r7)
      Creates a PairList with seven pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      l6 - the left element of the sixth pair
      r6 - the right element of the sixth pair
      l7 - the left element of the seventh pair
      r7 - the right element of the seventh pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5, LeftT l6, RightT r6, LeftT l7, RightT r7, LeftT l8, RightT r8)
      Creates a PairList with eight pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      l6 - the left element of the sixth pair
      r6 - the right element of the sixth pair
      l7 - the left element of the seventh pair
      r7 - the right element of the seventh pair
      l8 - the left element of the eighth pair
      r8 - the right element of the eighth pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5, LeftT l6, RightT r6, LeftT l7, RightT r7, LeftT l8, RightT r8, LeftT l9, RightT r9)
      Creates a PairList with nine pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      l6 - the left element of the sixth pair
      r6 - the right element of the sixth pair
      l7 - the left element of the seventh pair
      r7 - the right element of the seventh pair
      l8 - the left element of the eighth pair
      r8 - the right element of the eighth pair
      l9 - the left element of the ninth pair
      r9 - the right element of the ninth pair
      Gibt zurück:
      a new PairList containing the specified pairs
    • of

      public static <LeftT, RightT> PairList<LeftT,RightT> of(LeftT l1, RightT r1, LeftT l2, RightT r2, LeftT l3, RightT r3, LeftT l4, RightT r4, LeftT l5, RightT r5, LeftT l6, RightT r6, LeftT l7, RightT r7, LeftT l8, RightT r8, LeftT l9, RightT r9, LeftT l10, RightT r10)
      Creates a PairList with ten pairs.
      Typparameter:
      LeftT - the type of the left elements in the pairs
      RightT - the type of the right elements in the pairs
      Parameter:
      l1 - the left element of the first pair
      r1 - the right element of the first pair
      l2 - the left element of the second pair
      r2 - the right element of the second pair
      l3 - the left element of the third pair
      r3 - the right element of the third pair
      l4 - the left element of the fourth pair
      r4 - the right element of the fourth pair
      l5 - the left element of the fifth pair
      r5 - the right element of the fifth pair
      l6 - the left element of the sixth pair
      r6 - the right element of the sixth pair
      l7 - the left element of the seventh pair
      r7 - the right element of the seventh pair
      l8 - the left element of the eighth pair
      r8 - the right element of the eighth pair
      l9 - the left element of the ninth pair
      r9 - the right element of the ninth pair
      l10 - the left element of the tenth pair
      r10 - the right element of the tenth pair
      Gibt zurück:
      a new PairList containing the specified pairs