Package io.smallrye.mutiny.tuples
Class Tuple2<L,R>
- java.lang.Object
-
- io.smallrye.mutiny.tuples.Tuple2<L,R>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Object>
asList()
protected void
assertIndexInBounds(int index)
boolean
equals(java.lang.Object o)
L
getItem1()
Gets the first item.R
getItem2()
Gets the second item.int
hashCode()
<T> Tuple2<T,R>
mapItem1(java.util.function.Function<L,T> mapper)
<T> Tuple2<L,T>
mapItem2(java.util.function.Function<R,T> mapper)
java.lang.Object
nth(int index)
Get the item stored at the given index.static <L,R>
Tuple2<L,R>of(L l, R r)
int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
of
public static <L,R> Tuple2<L,R> of(L l, R r)
-
getItem1
public L getItem1()
Gets the first item.- Returns:
- The first item, can be
null
-
getItem2
public R getItem2()
Gets the second item.- Returns:
- The second item, can be
null
-
mapItem1
public <T> Tuple2<T,R> mapItem1(java.util.function.Function<L,T> mapper)
Applies a mapper function to the left (item1) part of thisTuple2
to produce a newTuple2
. The right part (item2) is not modified.- Type Parameters:
T
- the new type for the left item- Parameters:
mapper
- the mappingFunction
for the left item- Returns:
- the new
Tuple2
-
mapItem2
public <T> Tuple2<L,T> mapItem2(java.util.function.Function<R,T> mapper)
Applies a mapper function to the right part (item2) of thisTuple2
to produce a newTuple2
. The left (item1) part is not modified.- Type Parameters:
T
- the new type for the right item- Parameters:
mapper
- the mappingFunction
for the right item- Returns:
- the new
Tuple2
-
nth
public java.lang.Object nth(int index)
Description copied from interface:Tuple
Get the item stored at the given index.
-
assertIndexInBounds
protected void assertIndexInBounds(int index)
-
asList
public java.util.List<java.lang.Object> asList()
Description copied from interface:Tuple
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-