Class MutablePair<L,R>
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.lang3.tuple.Pair<L,R>
edu.internet2.middleware.grouperClientExt.org.apache.commons.lang3.tuple.MutablePair<L,R>
- Type Parameters:
L
- the left element typeR
- the right element type
- All Implemented Interfaces:
Serializable
,Comparable<Pair<L,
,R>> Map.Entry<L,
R>
A mutable pair consisting of two Object
elements.
Not #ThreadSafe#
- Since:
- 3.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MutablePair<?,
?>[] An empty array.Left objectRight object -
Constructor Summary
ConstructorDescriptionCreate a new pair instance of two nulls.MutablePair
(L left, R right) Create a new pair instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic <L,
R> MutablePair<L, R>[] Returns the empty array singleton that can be assigned without compiler warning.getLeft()
Gets the left element from this pair.getRight()
Gets the right element from this pair.static <L,
R> MutablePair<L, R> Creates a mutable pair from an existing pair.static <L,
R> MutablePair<L, R> of
(L left, R right) Creates a mutable pair of two objects inferring the generic types.void
Sets the left element of the pair.void
Sets the right element of the pair.Sets theMap.Entry
value.
-
Field Details
-
EMPTY_ARRAY
An empty array.Consider using
emptyArray()
to avoid generics warnings.- Since:
- 3.10.
-
left
Left object -
right
Right object
-
-
Constructor Details
-
MutablePair
public MutablePair()Create a new pair instance of two nulls. -
MutablePair
Create a new pair instance.- Parameters:
left
- the left value, may be nullright
- the right value, may be null
-
-
Method Details
-
emptyArray
Returns the empty array singleton that can be assigned without compiler warning.- Type Parameters:
L
- the left element typeR
- the right element type- Returns:
- the empty array singleton that can be assigned without compiler warning.
- Since:
- 3.10.
-
of
Creates a mutable pair of two objects inferring the generic types.
This factory allows the pair to be created using inference to obtain the generic types.
- Type Parameters:
L
- the left element typeR
- the right element type- Parameters:
left
- the left element, may be nullright
- the right element, may be null- Returns:
- a pair formed from the two parameters, not null
-
of
Creates a mutable pair from an existing pair.
This factory allows the pair to be created using inference to obtain the generic types.
- Type Parameters:
L
- the left element typeR
- the right element type- Parameters:
pair
- the existing pair.- Returns:
- a pair formed from the two parameters, not null
-
getLeft
Gets the left element from this pair.
When treated as a key-value pair, this is the key.
-
getRight
Gets the right element from this pair.
When treated as a key-value pair, this is the value.
-
setLeft
Sets the left element of the pair.- Parameters:
left
- the new value of the left element, may be null
-
setRight
Sets the right element of the pair.- Parameters:
right
- the new value of the right element, may be null
-
setValue
Sets theMap.Entry
value. This sets the right element of the pair.- Parameters:
value
- the right value to set, not null- Returns:
- the old value for the right element
-