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 java.lang.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$ $Date$
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      A a()  
      B b()  
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      boolean isEmpty()
      Returns whether this tupple is empty (composed with null values).
      static <A,​B>
      Tuple2<A,​B>
      of​(A a, B b)
      Creates a new instance.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.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