Package com.yetnt.utils.tuple
Class SamePair<T>
java.lang.Object
com.yetnt.utils.tuple.Pair<T,T>
com.yetnt.utils.tuple.SamePair<T>
- Type Parameters:
T- The type of both elements in the pair.
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SamePair<T> <U> SamePair<U> Applies a given mapping function to each element of this SamePair, returning a new SamePair with the transformed elements.<U> UmapTo(BiFunction<T, T, U> function) Applies the given function to the SamePair to return a single value.
-
Constructor Details
-
SamePair
Constructs a newSamePairwith the given first and second elements.- Parameters:
first- The first element of the pair.second- The second element of the pair.
-
-
Method Details
-
from
- Type Parameters:
T- The type the original pair has in both fields.- Parameters:
samePair- The pair- Returns:
- A new same pair
-
map
Applies a given mapping function to each element of this SamePair, returning a new SamePair with the transformed elements.- Type Parameters:
U- The type of the elements in the new SamePair after mapping.- Parameters:
function- The function to apply to each element.- Returns:
- A new
SamePaircontaining the results of applying the mapper function to each element.
-
mapTo
Applies the given function to the SamePair to return a single value.- Type Parameters:
U- The type of the single value to return- Parameters:
function- The mapper function- Returns:
- A single value
-