public class Tuple2<T1,T2> extends Object implements Tuple, Comparable<Tuple2<T1,T2>>, Serializable, Cloneable
| Constructor and Description |
|---|
Tuple2(T1 v1,
T2 v2) |
Tuple2(Tuple2<T1,T2> tuple) |
| Modifier and Type | Method and Description |
|---|---|
Object[] |
array()
Get an array representation of this tuple.
|
Tuple2<T1,T2> |
clone() |
int |
compareTo(Tuple2<T1,T2> other) |
int |
degree()
The degree of this tuple: 2.
|
boolean |
equals(Object o) |
int |
hashCode() |
static <T extends Comparable<T>> |
intersect(Tuple2<T,T> left,
Tuple2<T,T> right)
The intersection of two ranges.
|
Iterator<Object> |
iterator() |
List<?> |
list()
Get a list representation of this tuple.
|
<R> R |
map(Function2<T1,T2,R> function)
Apply this tuple as arguments to a function.
|
<U1> Tuple2<U1,T2> |
map1(Function1<T1,U1> function)
Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
|
<U2> Tuple2<T1,U2> |
map2(Function1<T2,U2> function)
Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
|
static <T extends Comparable<T>> |
overlaps(Tuple2<T,T> left,
Tuple2<T,T> right)
Whether two tuples overlap.
|
Tuple2<T2,T1> |
swap()
Get a tuple with the two attributes swapped.
|
String |
toString() |
T1 |
v1() |
T2 |
v2() |
finalize, getClass, notify, notifyAll, wait, wait, waitrange, tuple, tuple, tuple, tuple, tuple, tuple, tuple, tupleforEach, spliteratorpublic T1 v1()
public T2 v2()
public static final <T extends Comparable<T>> boolean overlaps(Tuple2<T,T> left, Tuple2<T,T> right)
// true
range(1, 3).overlaps(range(2, 4))
// false
range(1, 3).overlaps(range(5, 8))
public static final <T extends Comparable<T>> Optional<Tuple2<T,T>> intersect(Tuple2<T,T> left, Tuple2<T,T> right)
// (2, 3)
range(1, 3).intersect(range(2, 4))
// none
range(1, 3).intersect(range(5, 8))
public final <R> R map(Function2<T1,T2,R> function)
public final <U1> Tuple2<U1,T2> map1(Function1<T1,U1> function)
public final <U2> Tuple2<T1,U2> map2(Function1<T2,U2> function)
public final Object[] array()
Tuplepublic final List<?> list()
Tuplepublic final int degree()
public int compareTo(Tuple2<T1,T2> other)
compareTo in interface Comparable<Tuple2<T1,T2>>Copyright © 2014. All Rights Reserved.