Class Tuple2<A,​B>

  • Type Parameters:
    A - The object a type.
    B - The object b type.
    Direct Known Subclasses:
    Tuple3

    public class Tuple2<A,​B>
    extends Object
    Two-object holder. The two objects are called by convention, a and b.
    Implements equals(Object) and hashCode(), based on the two objects.
    If two tuples tup1 and tup2 have the same objects, but in different order, tup1.equals(tup2) may be false and tup1.hashCode() == tup2.hashCode() may be false.
    Example:
    Tuple2.newInstance(1, 2).equals(Tuple2.newInstance(2, 1)) is false.
    Tuple2.newInstance(1, 2).hashCode() == Tuple2.newInstance(2, 1).hashCode() is false.
    This holder accepts null values.
    Since:
    11.0.0
    Version:
    $Revision: 21880 $ $Date: 2018-09-21 17:07:19 -0300 (Fri, 21 Sep 2018) $
    • Method Detail

      • of

        public static <A,​B> Tuple2<A,​B> of​(A a,
                                                       B b)
        Creates a new instance.
        Parameters:
        a - the object a.
        b - the object b.
        Returns:
        the created instance.
        Since:
        11.0.0
      • a

        public A a()
      • b

        public B b()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isEmpty

        public boolean isEmpty()
        Returns whether this tupple is empty (composed with null values).
        Returns:
        whether this tupple is empty (composed with null values).
        Since:
        11.0.0