Package tools.helperclasses
Class MutablePair<T,U>
Object
AbstractPair<T,U>
AbstractMutablePair<T,U>
MutablePair<T,U>
public class MutablePair<T,U> extends AbstractMutablePair<T,U>
-
Constructor Summary
Constructors Constructor Description MutablePair(Map.Entry<T,U> entry)
Creates a mutable pair using a map entryMutablePair(AbstractPair<T,U> pair)
Creates a mutable pair using another pairMutablePair(T first, U second)
Creates a mutable pair by specifying its values -
Method Summary
Modifier and Type Method Description T
getFirst()
Returns the value of the first item in the pairU
getSecond()
Returns the value of the second item in the pairT
setFirst(T first)
Sets the first item in the pair and returns the old valueU
setSecond(U second)
Sets the second item in the pair and returns the old value
-
Constructor Details
-
MutablePair
Creates a mutable pair by specifying its values- Parameters:
first
- first value in the pairsecond
- second value in the pair
-
MutablePair
Creates a mutable pair using another pair- Parameters:
pair
- the pair containing the values to be used
-
MutablePair
Creates a mutable pair using a map entry- Parameters:
entry
- the entry containing the values to be used
-
-
Method Details
-
getFirst
Description copied from class:AbstractPair
Returns the value of the first item in the pair- Specified by:
getFirst
in classAbstractPair<T,U>
- Returns:
- the value of the first item in the pair
-
getSecond
Description copied from class:AbstractPair
Returns the value of the second item in the pair- Specified by:
getSecond
in classAbstractPair<T,U>
- Returns:
- the value of the second item in the pair
-
setFirst
Description copied from class:AbstractMutablePair
Sets the first item in the pair and returns the old value- Specified by:
setFirst
in classAbstractMutablePair<T,U>
- Parameters:
first
- the future value of the first item- Returns:
- the old value of the first item
-
setSecond
Description copied from class:AbstractMutablePair
Sets the second item in the pair and returns the old value- Specified by:
setSecond
in classAbstractMutablePair<T,U>
- Parameters:
second
- the future value of the second item- Returns:
- the old value of the second item
-