Class Triple<A,B,C>

java.lang.Object
it.tidalwave.util.Triple<A,B,C>

@Immutable public class Triple<A,B,C> extends Object
A value object that contains a triple of values.
Since:
3.2-ALPHA-12
Author:
Fabrizio Giudici
Status: draft API
  • Field Details

    • a

      @Nonnull public final A a
    • b

      @Nonnull public final B b
    • c

      @Nonnull public final C c
  • Constructor Details

    • Triple

      public Triple()
  • Method Details

    • of

      @Nonnull public static <T, U, V> Triple<T,U,V> of(@Nonnull Pair<T,U> pair, @Nonnull V value)
      Creates a Triple from a Pair and another value.
      Type Parameters:
      T - the former type of the Pair
      U - the latter type of the Pair
      V - the type of the value
      Parameters:
      pair - the Pair
      value - the value
      Returns:
      the Stream of Triples
    • tripleStream

      @Nonnull public static <T, U, V> Stream<Triple<T,U,V>> tripleStream(@Nonnull Pair<T,U> pair, @Nonnull Stream<? extends V> stream)
      Creates a Stream of Triples composed of a given Pair and another element taken from Stream.
      Type Parameters:
      T - the former type of the Pair
      U - the latter type of the Pair
      V - the type of the Stream
      Parameters:
      pair - the Pair
      stream - the Stream
      Returns:
      the Stream of Triples
    • tripleRange

      @Nonnull public static <T, U> Stream<Triple<T,U,Integer>> tripleRange(@Nonnull Pair<T,U> pair, @Nonnegative int from, @Nonnegative int to)
      Creates a Stream of Triples composed of a given fixed Pair and an integer in the given range.
      Type Parameters:
      T - the former type of the Pair
      U - the latter type of the Pair
      Parameters:
      pair - the Pair
      from - the first value of the integer Stream (included)
      to - the last value of the integer Stream (excluded)
      Returns:
      the Stream of Triples
    • tripleRangeClosed

      @Nonnull public static <T, U> Stream<Triple<T,U,Integer>> tripleRangeClosed(@Nonnull Pair<T,U> pair, @Nonnegative int from, @Nonnegative int to)
      Creates a Stream of Triples composed of a given fixed Pair and an integer in the given range.
      Type Parameters:
      T - the former type of the Pair
      U - the latter type of the Pair
      Parameters:
      pair - the Pair
      from - the first value of the integer Stream (included)
      to - the last value of the integer Stream (included)
      Returns:
      the Stream of Triples