Package com.yetnt.utils.tuple
Class MutablePair<T,U>
java.lang.Object
com.yetnt.utils.tuple.MutablePair<T,U>
- Type Parameters:
T- The type of the first elementU- The type of the second element
- Author:
- Lehlogonolo Poole
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
first
-
second
-
-
Constructor Details
-
MutablePair
Constructs a new MutablePair- Parameters:
first- The first valuesecond- The second value
-
-
Method Details
-
getFirst
Gets the first value- Returns:
- The first value
-
getSecond
Gets the second value- Returns:
- The second value
-
setFirst
Sets the first value- Parameters:
first- The new value
-
setSecond
Sets the second value- Parameters:
second- The new value
-
freeze
Creates a pair of the first and second value, effectively "freezing" them.This is similar to calling
MutablePair<T, U> mut = ...; Pair<T, U> pair1 = new Pair<>(mut); // using constructor Pair<T, U> pair2 = new Pair<>(mut.getFirst(), mut.getSecond()); // using values directly- Returns:
- A new pair
-