Class Tuples


  • public final class Tuples
    extends Object

    Static constructor methods for Tuples using the pattern &(....);

    Author:
    David B. Bracewell
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Tuple0 $()
      Creates a tuple of degree zero.
      static Tuple $​(@NonNull Object... items)
      Creates a tuple from the given array of items
      static <F> Tuple1<F> $​(F first)
      Creates a tuple of degree one.
      static <F,​S>
      Tuple2<F,​S>
      $​(F first, S second)
      Creates a pair.
      static <F,​S,​T>
      Tuple3<F,​S,​T>
      $​(F first, S second, T third)
      Creates a triple from the given items
      static <F,​S,​T,​D>
      Tuple4<F,​S,​T,​D>
      $​(F first, S second, T third, D fourth)
      Creates a tuple with degree four.
      static Tuple $​(List<?> list)
      Creates a tuple from a list of items.
    • Method Detail

      • $

        public static Tuple $​(List<?> list)

        Creates a tuple from a list of items. Empty or null lists return a 0-degree tuple.

        Parameters:
        list - the list of objects.
        Returns:
        the tuple
      • $

        public static <F,​S,​T> Tuple3<F,​S,​T> $​(F first,
                                                                      S second,
                                                                      T third)
        Creates a triple from the given items
        Type Parameters:
        F - the first type parameter
        S - the second type parameter
        T - the third type parameter
        Parameters:
        first - the first item
        second - the second item
        third - the third item
        Returns:
        the triple
      • $

        public static <F,​S,​T,​D> Tuple4<F,​S,​T,​D> $​(F first,
                                                                                      S second,
                                                                                      T third,
                                                                                      D fourth)
        Creates a tuple with degree four.
        Type Parameters:
        F - the first type parameter
        S - the second type parameter
        T - the third type parameter
        D - the fourth type parameter
        Parameters:
        first - the first item
        second - the second item
        third - the third item
        fourth - the fourth item
        Returns:
        the quadruple
      • $

        public static <F,​S> Tuple2<F,​S> $​(F first,
                                                      S second)
        Creates a pair.
        Type Parameters:
        F - the first type parameter
        S - the second type parameter
        Parameters:
        first - the first item
        second - the second item
        Returns:
        the pair
      • $

        public static Tuple0 $()
        Creates a tuple of degree zero.
        Returns:
        the tuple with degree zero.
      • $

        public static <F> Tuple1<F> $​(F first)
        Creates a tuple of degree one.
        Type Parameters:
        F - the first type parameter
        Parameters:
        first - the first item
        Returns:
        the tuple of degree one.
      • $

        public static Tuple $​(@NonNull
                              @NonNull Object... items)
        Creates a tuple from the given array of items
        Parameters:
        items - the items
        Returns:
        the tuple