T1
- The type of the first non-null value held by this tupleT2
- The type of the second non-null value held by this tuplepublic class Tuple2<T1,T2>
extends java.lang.Object
implements java.lang.Iterable<java.lang.Object>, java.io.Serializable
限定符和类型 | 方法和说明 |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(int index)
Get the object at the given index.
|
T1 |
getT1()
Type-safe way to get the first object of this
Tuples . |
T2 |
getT2()
Type-safe way to get the second object of this
Tuples . |
int |
hashCode() |
java.util.Iterator<java.lang.Object> |
iterator()
Return an immutable
Iterator<Object> around
the content of this Tuple . |
<R> Tuple2<R,T2> |
mapT1(java.util.function.Function<T1,R> mapper)
Map the left-hand part (T1) of this
Tuple2 into a different value and type,
keeping the right-hand part (T2). |
<R> Tuple2<T1,R> |
mapT2(java.util.function.Function<T2,R> mapper)
Map the right-hand part (T2) of this
Tuple2 into a different value and type,
keeping the left-hand part (T1). |
int |
size()
Return the number of elements in this Tuples.
|
java.lang.Object[] |
toArray()
Turn this
Tuple into a plain Object[] . |
java.util.List<java.lang.Object> |
toList()
Turn this
Tuple into a List<Object> . |
java.lang.String |
toString()
A Tuple String representation is the comma separated list of values, enclosed
in square brackets.
|
public T2 getT2()
Tuples
.public <R> Tuple2<R,T2> mapT1(java.util.function.Function<T1,R> mapper)
Tuple2
into a different value and type,
keeping the right-hand part (T2).R
- the new type for the left-hand partmapper
- the mapping Function
for the left-hand partTuple2
with a different left (T1) valuepublic <R> Tuple2<T1,R> mapT2(java.util.function.Function<T2,R> mapper)
Tuple2
into a different value and type,
keeping the left-hand part (T1).R
- the new type for the right-hand partmapper
- the mapping Function
for the right-hand partTuple2
with a different right (T2) value@Nullable public java.lang.Object get(int index)
index
- The index of the object to retrieve. Starts at 0.public java.util.List<java.lang.Object> toList()
Tuple
into a List<Object>
.
The list isn't tied to this Tuple but is a copy with limited
mutability (add
and remove
are not supported, but set
is).List<Object>
.public java.lang.Object[] toArray()
Tuple
into a plain Object[]
.
The array isn't tied to this Tuple but is a copy.Object[]
.public java.util.Iterator<java.lang.Object> iterator()
Iterator<Object>
around
the content of this Tuple
.iterator
在接口中 java.lang.Iterable<java.lang.Object>
Iterator
over the elements in this Tuple.public boolean equals(@Nullable java.lang.Object o)
equals
在类中 java.lang.Object
public int hashCode()
hashCode
在类中 java.lang.Object
public int size()
public final java.lang.String toString()
toString
在类中 java.lang.Object