Class Tuple2<K,​V>

    • Field Detail

      • v1

        public final K v1
        The first value
      • v2

        public final V v2
        The second value
    • Method Detail

      • of

        public static <K,​V> Tuple2<K,​V> of​(K key,
                                                       V value)
        Of tuple 2.
        Type Parameters:
        K - the type parameter
        V - the type parameter
        Parameters:
        key - the key
        value - the value
        Returns:
        the tuple 2
      • appendLeft

        public <T> Tuple3<T,​K,​V> appendLeft​(T object)
        Description copied from class: Tuple
        Appends an item the beginning of the tuple resulting in a new tuple of degree + 1
        Overrides:
        appendLeft in class Tuple
        Type Parameters:
        T - the type parameter
        Parameters:
        object - the object being appended
        Returns:
        A new tuple of degree + 1 containing the object at the beginning
      • appendRight

        public <T> Tuple3<K,​V,​T> appendRight​(T object)
        Description copied from class: Tuple
        Appends an item the end of the tuple resulting in a new tuple of degree + 1
        Overrides:
        appendRight in class Tuple
        Type Parameters:
        T - the type parameter
        Parameters:
        object - the object being appended
        Returns:
        A new tuple of degree + 1 containing the object at the end
      • array

        public Object[] array()
        Description copied from class: Tuple
        The tuple as an array of objects
        Specified by:
        array in class Tuple
        Returns:
        an array representing the items in the tuple
      • copy

        public Tuple2<K,​V> copy()
        Description copied from interface: Copyable

        Makes a copy of this object.

        Specified by:
        copy in interface Copyable<K>
        Returns:
        A copy of this object.
      • degree

        public int degree()
        Description copied from class: Tuple
        The number of items in the tuple
        Specified by:
        degree in class Tuple
        Returns:
        the number of items in the tuple
      • get

        public <T> T get​(int i)
        Description copied from class: Tuple
        Gets the ith item of the tuple.
        Overrides:
        get in class Tuple
        Type Parameters:
        T - the type parameter
        Parameters:
        i - the index of the item
        Returns:
        the item at the ith index
      • getV1

        public K getV1()
      • getV2

        public V getV2()
      • shiftLeft

        public Tuple1<V> shiftLeft()
        Description copied from class: Tuple
        Shifts the first element of the tuple resulting in a tuple of degree - 1.
        Overrides:
        shiftLeft in class Tuple
        Returns:
        A new tuple without the shifted element;
      • shiftRight

        public Tuple1<K> shiftRight()
        Description copied from class: Tuple
        Shifts the last element of the tuple resulting in a tuple of degree - 1.
        Overrides:
        shiftRight in class Tuple
        Returns:
        A new tuple without the shifted element;