All Implemented Interfaces:
Serializable
,
Cloneable
,
Comparable
<
Tuple2
<T1,T2>>,
Iterable
<
Object
>,
Tuple
Direct Known Subclasses:
Range
public class Tuple2<T1,T2>
extends Object
implements Tuple, Comparable<Tuple2<T1,T2>>, Serializable, Cloneable
A tuple of degree 2.
Author:
Lukas Eder
See Also:
Serialized Form
<T3,T4,T5,T6,T7,T8>
Tuple8
<
T1
,
T2
,T3,T4,T5,T6,T7,T8>
concat
(
Tuple6
<T3,T4,T5,T6,T7,T8> tuple)
Concatenate a tuple to this tuple.
degree
()
The degree of this tuple: 2.
boolean
equals
(
Object
o)
hashCode
()
static <T extends
Comparable
<T>>
Optional
<
Tuple2
<T,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.
map
(
Function2
<
T1
,
T2
,R> function)
Apply this tuple as arguments to a function.
<U1>
Tuple2
<U1,
T2
>
map1
(
Function1
<? super
T1
,? extends 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
<? super
T2
,? extends U2> function)
Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
static <T extends
Comparable
<T>>
boolean
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
()
v1
()
v2
()
concat
public final <T3,T4,T5,T6> Tuple6<T1,T2,T3,T4,T5,T6> concat(Tuple4<T3,T4,T5,T6> tuple)
Concatenate a tuple to this tuple.
concat
public final <T3,T4,T5,T6,T7> Tuple7<T1,T2,T3,T4,T5,T6,T7> concat(Tuple5<T3,T4,T5,T6,T7> tuple)
Concatenate a tuple to this tuple.
concat
public final <T3,T4,T5,T6,T7,T8> Tuple8<T1,T2,T3,T4,T5,T6,T7,T8> concat(Tuple6<T3,T4,T5,T6,T7,T8> tuple)
Concatenate a tuple to this tuple.
overlaps
public static final <T extends Comparable<T>> boolean overlaps(Tuple2<T,T> left,
Tuple2<T,T> right)
Whether two tuples overlap.
// true
range(1, 3).overlaps(range(2, 4))
// false
range(1, 3).overlaps(range(5, 8))
intersect
public static final <T extends Comparable<T>> Optional<Tuple2<T,T>> intersect(Tuple2<T,T> left,
Tuple2<T,T> right)
The intersection of two ranges.
// (2, 3)
range(1, 3).intersect(range(2, 4))
// none
range(1, 3).intersect(range(5, 8))
public final <U1> Tuple2<U1,T2> map1(Function1<? super T1,? extends U1> function)
Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
public final <U2> Tuple2<T1,U2> map2(Function1<? super T2,? extends U2> function)
Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
public final Object[] array()
Description copied from interface:
Tuple
Get an array representation of this tuple.
Specified by:
array
in interface
Tuple
public final List<?> list()
Description copied from interface:
Tuple
Get a list representation of this tuple.
Specified by:
list
in interface
Tuple