Package org.threadly.util
Class MutablePair<L,R>
- java.lang.Object
-
- org.threadly.util.Pair<L,R>
-
- org.threadly.util.MutablePair<L,R>
-
- Type Parameters:
L
- Type of 'left' object to be heldR
- Type of 'right' object to be held
public class MutablePair<L,R> extends Pair<L,R>
A special type ofPair
which allows the stored references to be updated after creation. Note that stored references are notvolatile
orsynchronized
, so thread access must be guarded in synchronization.- Since:
- 4.4.0
-
-
Constructor Summary
Constructors Constructor Description MutablePair()
Constructs a new mutable pair with the left and right references defaulted to benull
.MutablePair(L left, R right)
Constructs a new mutable pair, providing the left and right objects to be held.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setLeft(L left)
Update the left reference with the provided object.void
setRight(R right)
Update the right reference with the provided object.-
Methods inherited from class org.threadly.util.Pair
applyToLeft, applyToRight, collectLeft, collectRight, containsLeft, containsRight, convertMap, equals, getLeft, getLeftFromRight, getRight, getRightFromLeft, hashCode, iterateLeft, iterateLeft, iterateRight, iterateRight, split, toString, transform, transformLeft, transformRight
-
-
-
-
Method Detail
-
setLeft
public void setLeft(L left)
Update the left reference with the provided object.- Parameters:
left
- New reference to be used for the left of the pair
-
setRight
public void setRight(R right)
Update the right reference with the provided object.- Parameters:
right
- New reference to be used for the right of the pair
-
-