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 voidassertIndexInBounds(int index)booleanequals(java.lang.Object o)LgetItem1()Gets the first item.RgetItem2()Gets the second item.inthashCode()<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.Objectnth(int index)Get the item stored at the given index.static <L,R>
Tuple2<L,R>of(L l, R r)intsize()java.lang.StringtoString()
-
-
-
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 thisTuple2to produce a newTuple2. The right part (item2) is not modified.- Type Parameters:
T- the new type for the left item- Parameters:
mapper- the mappingFunctionfor 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 thisTuple2to produce a newTuple2. The left (item1) part is not modified.- Type Parameters:
T- the new type for the right item- Parameters:
mapper- the mappingFunctionfor the right item- Returns:
- the new
Tuple2
-
nth
public java.lang.Object nth(int index)
Description copied from interface:TupleGet 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-