Package org.storynode.pigeon.tuple
Class Tuple
java.lang.Object
org.storynode.pigeon.tuple.Tuple
A tuple may be defined in many ways, but simply speaking it's a finite, heterogeneous sequence of
elements.
- Since:
- 1.0.0
- Author:
- Andrea Coronese
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEnumerates the items in this tuplebooleanstatic <T1,T2> @NotNull Pair <T1, T2> of(T1 first, T2 second) Creates aTupleof two elementsstatic <T1,T2, T3>
@NotNull Triplet<T1, T2, T3> of(T1 first, T2 second, T3 third) Creates aTupleof three elementsstatic <T1,T2, T3, T4>
@NotNull Quartet<T1, T2, T3, T4> of(T1 first, T2 second, T3 third, T4 fourth) Creates aTupleof four elementsstatic <T1,T2, T3, T4, T5>
@NotNull Quintet<T1, T2, T3, T4, T5> of(T1 first, T2 second, T3 third, T4 fourth, T5 fifth) Creates aTupleof five elements
-
Constructor Details
-
Tuple
public Tuple()
-
-
Method Details
-
of
@Contract("_, _ -> new") @NotNull public static <T1,T2> @NotNull Pair<T1,T2> of(T1 first, T2 second) Creates aTupleof two elements- Type Parameters:
T1- The type of the first elementT2- The type of the second element- Parameters:
first- The first elementsecond- The second element- Returns:
- The
Tuple
-
of
@Contract("_, _, _ -> new") @NotNull public static <T1,T2, @NotNull Triplet<T1,T3> T2, ofT3> (T1 first, T2 second, T3 third) Creates aTupleof three elements- Type Parameters:
T1- The type of the first elementT2- The type of the second elementT3- The type of the third element- Parameters:
first- The first elementsecond- The second elementthird- The third element- Returns:
- The [Tuple]
-
of
@Contract("_, _, _, _ -> new") @NotNull public static <T1,T2, @NotNull Quartet<T1,T3, T4> T2, ofT3, T4> (T1 first, T2 second, T3 third, T4 fourth) Creates aTupleof four elements- Type Parameters:
T1- The type of the first elementT2- The type of the second elementT3- The type of the third elementT4- The type of the fourth element- Parameters:
first- The first elementsecond- The second elementthird- The third elementfourth- The fourth element- Returns:
- The
Tuple
-
of
@Contract("_, _, _, _, _ -> new") @NotNull public static <T1,T2, @NotNull Quintet<T1,T3, T4, T5> T2, ofT3, T4, T5> (T1 first, T2 second, T3 third, T4 fourth, T5 fifth) Creates aTupleof five elements- Type Parameters:
T1- The type of the first elementT2- The type of the second elementT3- The type of the third elementT4- The type of the fourth elementT5- The type of the fifth element- Parameters:
first- The first elementsecond- The second elementthird- The third elementfourth- The fourth elementfifth- The fifth element- Returns:
- The [Tuple]
-
enumerate
Enumerates the items in this tuple- Returns:
- An
Iterableof pairs each containing an item and its index
-
equals
Checks whether the
otherinstance is equal tothis
-