Class Tuples


  • public class Tuples
    extends java.lang.Object
    Common static factory utilities for tuples.
    Since:
    1.7
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Tuple flatTupleOf​(java.lang.Object... elements)
      Creates a flat tuple consisting of the given elements.
      static Tuple leftInheritanceTupleOf​(Tuple ancestor, java.lang.Object... localElements)
      Creates a left inheritance tuple that extends an ancestor tuple by the given "local" elements.
      static Tuple staticArityFlatTupleOf()
      Creates a flat tuple consisting of no elements.
      static Tuple staticArityFlatTupleOf​(java.lang.Object element)
      Creates a flat tuple consisting of the given single element.
      static Tuple staticArityFlatTupleOf​(java.lang.Object element0, java.lang.Object element1)
      Creates a flat tuple consisting of the given elements.
      static Tuple staticArityFlatTupleOf​(java.lang.Object element0, java.lang.Object element1, java.lang.Object element2)
      Creates a flat tuple consisting of the given elements.
      static Tuple staticArityFlatTupleOf​(java.lang.Object element0, java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
      Creates a flat tuple consisting of the given elements.
      static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor, java.lang.Object element)
      Creates a left inheritance tuple consisting of the given single local element.
      static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor, java.lang.Object element0, java.lang.Object element1)
      Creates a left inheritance tuple consisting of the given local elements.
      static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor, java.lang.Object element0, java.lang.Object element1, java.lang.Object element2)
      Creates a left inheritance tuple consisting of the given local elements.
      static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor, java.lang.Object element0, java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
      Creates a left inheritance tuple consisting of the given local elements.
      static Tuple wideFlatTupleOf​(java.lang.Object... elements)
      Creates a flat tuple consisting of the given elements.
      static Tuple wideLeftInheritanceTupleOf​(Tuple ancestor, java.lang.Object... elements)
      Creates a left inheritance tuple consisting of the given local elements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • flatTupleOf

        public static Tuple flatTupleOf​(java.lang.Object... elements)
        Creates a flat tuple consisting of the given elements. For low-arity tuples, specialized implementations (such as FlatTuple2) will be instantiated.

        In case the exact arity is statically known, it may be more efficient for the client to instantiate the appropriate specialized implementation (via staticArityFlatTupleOf(Object, Object) etc. or wideFlatTupleOf(Object...)), instead of invoking this method. This method does a runtime arity check, and therefore also appropriate if the arity is determined at runtime.

      • leftInheritanceTupleOf

        public static Tuple leftInheritanceTupleOf​(Tuple ancestor,
                                                   java.lang.Object... localElements)
        Creates a left inheritance tuple that extends an ancestor tuple by the given "local" elements. For locally low-arity tuples, specialized implementations (such as LeftInheritanceTuple2) will be instantiated.

        In case the exact arity is statically known, it may be more efficient for the client to instantiate the appropriate specialized implementation (via #staticArityLeftInheritanceTupleOf(Object, Object) etc. or #wideLeftInheritanceTupleOf(Object...)), instead of invoking this method. This method does a runtime arity check, and therefore also appropriate if the arity is determined at runtime.

      • staticArityFlatTupleOf

        public static Tuple staticArityFlatTupleOf()
        Creates a flat tuple consisting of no elements.
      • staticArityFlatTupleOf

        public static Tuple staticArityFlatTupleOf​(java.lang.Object element)
        Creates a flat tuple consisting of the given single element.
      • staticArityFlatTupleOf

        public static Tuple staticArityFlatTupleOf​(java.lang.Object element0,
                                                   java.lang.Object element1)
        Creates a flat tuple consisting of the given elements.
      • staticArityFlatTupleOf

        public static Tuple staticArityFlatTupleOf​(java.lang.Object element0,
                                                   java.lang.Object element1,
                                                   java.lang.Object element2)
        Creates a flat tuple consisting of the given elements.
      • staticArityFlatTupleOf

        public static Tuple staticArityFlatTupleOf​(java.lang.Object element0,
                                                   java.lang.Object element1,
                                                   java.lang.Object element2,
                                                   java.lang.Object element3)
        Creates a flat tuple consisting of the given elements.
      • wideFlatTupleOf

        public static Tuple wideFlatTupleOf​(java.lang.Object... elements)
        Creates a flat tuple consisting of the given elements.

        Invoke this only if it is statically known that the tuple will be wide. Otherwise, use flatTupleOf(Object...).

      • staticArityLeftInheritanceTupleOf

        public static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor,
                                                              java.lang.Object element)
        Creates a left inheritance tuple consisting of the given single local element.
      • staticArityLeftInheritanceTupleOf

        public static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor,
                                                              java.lang.Object element0,
                                                              java.lang.Object element1)
        Creates a left inheritance tuple consisting of the given local elements.
      • staticArityLeftInheritanceTupleOf

        public static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor,
                                                              java.lang.Object element0,
                                                              java.lang.Object element1,
                                                              java.lang.Object element2)
        Creates a left inheritance tuple consisting of the given local elements.
      • staticArityLeftInheritanceTupleOf

        public static Tuple staticArityLeftInheritanceTupleOf​(Tuple ancestor,
                                                              java.lang.Object element0,
                                                              java.lang.Object element1,
                                                              java.lang.Object element2,
                                                              java.lang.Object element3)
        Creates a left inheritance tuple consisting of the given local elements.
      • wideLeftInheritanceTupleOf

        public static Tuple wideLeftInheritanceTupleOf​(Tuple ancestor,
                                                       java.lang.Object... elements)
        Creates a left inheritance tuple consisting of the given local elements.

        Invoke this only if it is statically known that the tuple will be wide. Otherwise, use leftInheritanceTupleOf(Tuple, Object...).