Package no.digipost.tuple
Interface Quadruple<T1,T2,T3,T4>
-
- Type Parameters:
T1- The type of the first valueT2- The type of the second valueT3- The type of the third valueT4- The type of the fourth value
- All Superinterfaces:
ViewableAsQuadruple<T1,T2,T3,T4>
public interface Quadruple<T1,T2,T3,T4> extends ViewableAsQuadruple<T1,T2,T3,T4>
A quadruple is a simple composition of four arbitrary values (objects). A quadruple captures no semantics of the four values, and they are only referred to as "the first", "the second", "the third", and "the fourth" value.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Quadruple<T1,T2,T3,T4>asQuadruple()T1first()static <T1,T2,T3,T4>
Quadruple<T1,T2,T3,T4>flatten(Tuple<Tuple<Tuple<T1,T2>,T3>,T4> nestedTuple)T4fourth()<S1,S2,S3,S4>
Quadruple<S1,S2,S3,S4>map(Function<? super T1,? extends S1> firstMapper, Function<? super T2,? extends S2> secondMapper, Function<? super T3,? extends S3> thirdMapper, Function<? super T4,? extends S4> fourthMapper)Create a new quadruple by applying a function to each element, and putting the results into a new quadruple.<S1> Quadruple<S1,T2,T3,T4>mapFirst(Function<? super T1,? extends S1> mapper)Create a new quadruple by applying a function to the first element, and putting the result as the first element of the new quadruple.<S4> Quadruple<T1,T2,T3,S4>mapFourth(Function<? super T4,? extends S4> mapper)Create a new quadruple by applying a function to the fourth element, and putting the result as the fourth element of the new quadruple.<S2> Quadruple<T1,S2,T3,T4>mapSecond(Function<? super T2,? extends S2> mapper)Create a new quadruple by applying a function to the second element, and putting the result as the second element of the new quadruple.<S3> Quadruple<T1,T2,S3,T4>mapThird(Function<? super T3,? extends S3> mapper)Create a new quadruple by applying a function to the third element, and putting the result as the third element of the new quadruple.static <T1,T2,T3,T4>
Quadruple<T1,T2,T3,T4>of(T1 first, T2 second, T3 third, T4 fourth)T2second()T3third()<R> Rto(QuadFunction<? super T1,? super T2,? super T3,? super T4,R> convertor)Convert this quadruple to an instance of an arbitrary type.
-
-
-
Method Detail
-
of
static <T1,T2,T3,T4> Quadruple<T1,T2,T3,T4> of(T1 first, T2 second, T3 third, T4 fourth)
-
flatten
static <T1,T2,T3,T4> Quadruple<T1,T2,T3,T4> flatten(Tuple<Tuple<Tuple<T1,T2>,T3>,T4> nestedTuple)
-
first
T1 first()
- Returns:
- the first value
-
second
T2 second()
- Returns:
- the second value
-
third
T3 third()
- Returns:
- the third value
-
fourth
T4 fourth()
- Returns:
- the fourth value
-
mapFirst
<S1> Quadruple<S1,T2,T3,T4> mapFirst(Function<? super T1,? extends S1> mapper)
Create a new quadruple by applying a function to the first element, and putting the result as the first element of the new quadruple.- Parameters:
mapper- the function to apply to the first element- Returns:
- the new quadruple
-
mapSecond
<S2> Quadruple<T1,S2,T3,T4> mapSecond(Function<? super T2,? extends S2> mapper)
Create a new quadruple by applying a function to the second element, and putting the result as the second element of the new quadruple.- Parameters:
mapper- the function to apply to the second element- Returns:
- the new quadruple
-
mapThird
<S3> Quadruple<T1,T2,S3,T4> mapThird(Function<? super T3,? extends S3> mapper)
Create a new quadruple by applying a function to the third element, and putting the result as the third element of the new quadruple.- Parameters:
mapper- the function to apply to the third element- Returns:
- the new quadruple
-
mapFourth
<S4> Quadruple<T1,T2,T3,S4> mapFourth(Function<? super T4,? extends S4> mapper)
Create a new quadruple by applying a function to the fourth element, and putting the result as the fourth element of the new quadruple.- Parameters:
mapper- the function to apply to the fourth element- Returns:
- the new quadruple
-
map
<S1,S2,S3,S4> Quadruple<S1,S2,S3,S4> map(Function<? super T1,? extends S1> firstMapper, Function<? super T2,? extends S2> secondMapper, Function<? super T3,? extends S3> thirdMapper, Function<? super T4,? extends S4> fourthMapper)
Create a new quadruple by applying a function to each element, and putting the results into a new quadruple.- Parameters:
firstMapper- the function to apply to the first elementsecondMapper- the function to apply to the second elementthirdMapper- the function to apply to the third elementfourthMapper- the function to apply to the fourth element- Returns:
- the new quadruple
-
asQuadruple
Quadruple<T1,T2,T3,T4> asQuadruple()
- Specified by:
asQuadruplein interfaceViewableAsQuadruple<T1,T2,T3,T4>- Returns:
- this quadruple instance
-
to
<R> R to(QuadFunction<? super T1,? super T2,? super T3,? super T4,R> convertor)
Convert this quadruple to an instance of an arbitrary type.- Type Parameters:
R- The type of the resulting instance- Parameters:
convertor- the function used to convert the contained values to a resulting compound instance.- Returns:
- the result from the given function
-
-