Top Description Fields Constructors Methods
io.vavr

public final Class Tuple1<T1>

extends Object
implements Tuple, Comparable<Tuple1<T1>>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Comparable, io.vavr.Tuple
Type Parameters
<T1>
type of the 1st element
Imports
io.vavr.collection.List, .Seq, java.io.Serializable, java.util.Comparator, .Objects, java.util.function.Function

A tuple of one element which can be seen as cartesian product of one component.
Author
Daniel Dietrich

Field Summary

Modifier and TypeField and Description
public final T1
_1

The 1st element of this tuple.

private static final long

Constructor Summary

AccessConstructor and Description
public
Tuple1(T1
the 1st element
t1
)

Constructs a tuple of one element.

Method Summary

Modifier and TypeMethod and Description
public T1

Returns:

the 1st element of this Tuple.
_1
()

Getter of the 1st element of this tuple.

public <
type of the value to append
T2
>
Tuple2<T1, T2>

Returns:

a new Tuple with the value appended
append
(T2
the value to append
t2
)

Append a value to this tuple.

public <
type of the transformation result
U
>
U

Returns:

An object of type U
apply
(Function<? super T1, ? extends U>
Transformation which creates a new object of type U based on this tuple's contents.
f
)

Transforms this tuple to an object of type U.

public int
arity()

Implements io.vavr.Tuple.arity.

Returns the number of elements of this tuple.

public static <T1> Comparator<Tuple1<T1>>
comparator(Comparator<? super T1> t1Comp)

private static <U1 extends Comparable<? super U1>> int
compareTo(Tuple1<?> o1, Tuple1<?> o2)

public int
compareTo(Tuple1<T1>
the object to be compared.
that
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public <
the type of the 2nd value in the tuple
T2
>
Tuple2<T1, T2>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple1<T2>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
>
Tuple3<T1, T2, T3>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple2<T2, T3>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
,
the type of the 4th value in the tuple
T4
>
Tuple4<T1, T2, T3, T4>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple3<T2, T3, T4>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
,
the type of the 4th value in the tuple
T4
,
the type of the 5th value in the tuple
T5
>
Tuple5<T1, T2, T3, T4, T5>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple4<T2, T3, T4, T5>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
,
the type of the 4th value in the tuple
T4
,
the type of the 5th value in the tuple
T5
,
the type of the 6th value in the tuple
T6
>
Tuple6<T1, T2, T3, T4, T5, T6>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple5<T2, T3, T4, T5, T6>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
,
the type of the 4th value in the tuple
T4
,
the type of the 5th value in the tuple
T5
,
the type of the 6th value in the tuple
T6
,
the type of the 7th value in the tuple
T7
>
Tuple7<T1, T2, T3, T4, T5, T6, T7>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple6<T2, T3, T4, T5, T6, T7>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public <
the type of the 2nd value in the tuple
T2
,
the type of the 3rd value in the tuple
T3
,
the type of the 4th value in the tuple
T4
,
the type of the 5th value in the tuple
T5
,
the type of the 6th value in the tuple
T6
,
the type of the 7th value in the tuple
T7
,
the type of the 8th value in the tuple
T8
>
Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>

Returns:

a new Tuple with the tuple values appended
concat
(Tuple7<T2, T3, T4, T5, T6, T7, T8>
the tuple to concat
tuple
)

Concat a tuple's values to this tuple.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public <
new type of the 1st component
U1
>
Tuple1<U1>

Returns:

A new Tuple of same arity.
map
(Function<? super T1, ? extends U1>
the mapper function
mapper
)

Maps the components of this tuple using a mapper function.

public Seq<?>
toSeq()

Implements io.vavr.Tuple.toSeq.

Converts this tuple to a sequence.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public Tuple1<T1>

Returns:

a copy of this tuple with a new value for the 1st element of this Tuple.
update1
(T1
the new value
value
)

Sets the 1st element of this tuple to the given value.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

_1back to summary
public final T1 _1

The 1st element of this tuple.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
private static final long serialVersionUID

Hides io.vavr.Tuple.serialVersionUID.

Constructor Detail

Tuple1back to summary
public Tuple1(T1 t1)

Constructs a tuple of one element.

Parameters
t1:T1

the 1st element

Method Detail

_1back to summary
public T1 _1()

Getter of the 1st element of this tuple.

Returns:T1

the 1st element of this Tuple.

appendback to summary
public <T2> Tuple2<T1, T2> append(T2 t2)

Append a value to this tuple.

Parameters
<T2>
type of the value to append
t2:T2

the value to append

Returns:Tuple2<T1, T2>

a new Tuple with the value appended

applyback to summary
public <U> U apply(Function<? super T1, ? extends U> f)

Transforms this tuple to an object of type U.

Parameters
<U>
type of the transformation result
f:Function<? super T1, ? extends U>

Transformation which creates a new object of type U based on this tuple's contents.

Returns:U

An object of type U

Exceptions
NullPointerException:
if f is null
arityback to summary
public int arity()

Implements io.vavr.Tuple.arity.

Doc from io.vavr.Tuple.arity.

Returns the number of elements of this tuple.

Returns:int

the number of elements.

Annotations
@Override
comparatorback to summary
public static <T1> Comparator<Tuple1<T1>> comparator(Comparator<? super T1> t1Comp)
compareToback to summary
private static <U1 extends Comparable<? super U1>> int compareTo(Tuple1<?> o1, Tuple1<?> o2)
Annotations
@SuppressWarnings:unchecked
compareToback to summary
public int compareTo(Tuple1<T1> that)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
that:Tuple1<T1>

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
concatback to summary
public <T2> Tuple2<T1, T2> concat(Tuple1<T2> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
tuple:Tuple1<T2>

the tuple to concat

Returns:Tuple2<T1, T2>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3> Tuple3<T1, T2, T3> concat(Tuple2<T2, T3> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
tuple:Tuple2<T2, T3>

the tuple to concat

Returns:Tuple3<T1, T2, T3>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3, T4> Tuple4<T1, T2, T3, T4> concat(Tuple3<T2, T3, T4> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
<T4>
the type of the 4th value in the tuple
tuple:Tuple3<T2, T3, T4>

the tuple to concat

Returns:Tuple4<T1, T2, T3, T4>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple4<T2, T3, T4, T5> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
<T4>
the type of the 4th value in the tuple
<T5>
the type of the 5th value in the tuple
tuple:Tuple4<T2, T3, T4, T5>

the tuple to concat

Returns:Tuple5<T1, T2, T3, T4, T5>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3, T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple5<T2, T3, T4, T5, T6> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
<T4>
the type of the 4th value in the tuple
<T5>
the type of the 5th value in the tuple
<T6>
the type of the 6th value in the tuple
tuple:Tuple5<T2, T3, T4, T5, T6>

the tuple to concat

Returns:Tuple6<T1, T2, T3, T4, T5, T6>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3, T4, T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple6<T2, T3, T4, T5, T6, T7> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
<T4>
the type of the 4th value in the tuple
<T5>
the type of the 5th value in the tuple
<T6>
the type of the 6th value in the tuple
<T7>
the type of the 7th value in the tuple
tuple:Tuple6<T2, T3, T4, T5, T6, T7>

the tuple to concat

Returns:Tuple7<T1, T2, T3, T4, T5, T6, T7>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
concatback to summary
public <T2, T3, T4, T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple)

Concat a tuple's values to this tuple.

Parameters
<T2>
the type of the 2nd value in the tuple
<T3>
the type of the 3rd value in the tuple
<T4>
the type of the 4th value in the tuple
<T5>
the type of the 5th value in the tuple
<T6>
the type of the 6th value in the tuple
<T7>
the type of the 7th value in the tuple
<T8>
the type of the 8th value in the tuple
tuple:Tuple7<T2, T3, T4, T5, T6, T7, T8>

the tuple to concat

Returns:Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>

a new Tuple with the tuple values appended

Exceptions
NullPointerException:
if tuple is null
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
mapback to summary
public <U1> Tuple1<U1> map(Function<? super T1, ? extends U1> mapper)

Maps the components of this tuple using a mapper function.

Parameters
<U1>
new type of the 1st component
mapper:Function<? super T1, ? extends U1>

the mapper function

Returns:Tuple1<U1>

A new Tuple of same arity.

Exceptions
NullPointerException:
if mapper is null
toSeqback to summary
public Seq<?> toSeq()

Implements io.vavr.Tuple.toSeq.

Doc from io.vavr.Tuple.toSeq.

Converts this tuple to a sequence.

Returns:Seq<?>

A new Seq.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
update1back to summary
public Tuple1<T1> update1(T1 value)

Sets the 1st element of this tuple to the given value.

Parameters
value:T1

the new value

Returns:Tuple1<T1>

a copy of this tuple with a new value for the 1st element of this Tuple.