Reputation: 65
How do you create a Reactor Tuple, such as reactor.util.function.Tuple2<T1,T2> ?
Upvotes: 0
Views: 571
Reputation: 65
Use reactor.util.function.Tuples.of(T1 t1, T2 t2)
Note that it uses the Tuples class.
Method signature:
static <T1,T2> Tuple2<T1,T2> of(T1 t1, T2 t2)
More methods and constructors available in the Javadoc
Upvotes: 2
Reputation: 20544
There are plenty of tuple libraries.
One of them is Java SDK, which have Map.Entry
. You can create it with Map.entry()
.
There are also org.apache.commons.lang3.tuple.Pair
from
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
It use Pair.of()
method.
There are plenty of others. Most of them use similar approach.
To answer your specific question: There is reactor.util.function.Tuples.of()
method.
Upvotes: 0