L
- the left element typeR
- the right element typepublic class MutablePair<L,R> extends Pair<L,R>
A mutable pair consisting of two Object
elements.
Not #ThreadSafe#
Modifier and Type | Field and Description |
---|---|
L |
left
Left object
|
R |
right
Right object
|
Constructor and Description |
---|
MutablePair()
Create a new pair instance of two nulls.
|
MutablePair(L left,
R right)
Create a new pair instance.
|
Modifier and Type | Method and Description |
---|---|
L |
getLeft()
Gets the left element from this pair.
|
R |
getRight()
Gets the right element from this pair.
|
static <L,R> MutablePair<L,R> |
of(L left,
R right)
Obtains an immutable pair of from two objects inferring the generic types.
|
void |
setLeft(L left)
Sets the left element of the pair.
|
void |
setRight(R right)
Sets the right element of the pair.
|
R |
setValue(R value)
Sets the
Map.Entry value. |
compareTo, equals, getKey, getValue, hashCode, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
public MutablePair()
public MutablePair(L left, R right)
left
- the left value, may be nullright
- the right value, may be nullpublic static <L,R> MutablePair<L,R> of(L left, R right)
Obtains an immutable pair of from two objects inferring the generic types.
This factory allows the pair to be created using inference to obtain the generic types.
L
- the left element typeR
- the right element typeleft
- the left element, may be nullright
- the right element, may be nullpublic L getLeft()
Gets the left element from this pair.
When treated as a key-value pair, this is the key.
public void setLeft(L left)
left
- the new value of the left element, may be nullpublic R getRight()
Gets the right element from this pair.
When treated as a key-value pair, this is the value.
public void setRight(R right)
right
- the new value of the right element, may be nullCopyright © 2001–2017 The Apache Software Foundation. All rights reserved.