Package lumis.util.collections
Class Tuple2<A,B>
- java.lang.Object
-
- lumis.util.collections.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
andb
.
Implementsequals(Object)
andhashCode()
, based on the two objects.
If two tuplestup1
andtup2
have the same objects, but in different order,tup1.equals(tup2)
may be false andtup1.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 acceptsnull
values.- Since:
- 11.0.0
- Version:
- $Revision: 21880 $ $Date: 2018-09-21 17:07:19 -0300 (Fri, 21 Sep 2018) $
-
-
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 withnull
values).static <A,B>
Tuple2<A,B>of(A a, B b)
Creates a new instance.java.lang.String
toString()
-
-
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isEmpty
public boolean isEmpty()
Returns whether this tupple is empty (composed withnull
values).- Returns:
- whether this tupple is empty (composed with
null
values). - Since:
- 11.0.0
-
-