Package org.camunda.bpm.engine.impl.util
Class ImmutablePair<L,R>
java.lang.Object
org.camunda.bpm.engine.impl.util.ImmutablePair<L,R>
- Type Parameters:
L
- the type of the left elementR
- the type of the right element
- All Implemented Interfaces:
Serializable
,Comparable<ImmutablePair<L,
,R>> Map.Entry<L,
R>
public class ImmutablePair<L,R>
extends Object
implements Map.Entry<L,R>, Serializable, Comparable<ImmutablePair<L,R>>
Immutable representation of a 2-tuple of elements.
Although the implementation is immutable, there is no restriction on the
objects that may be stored. If mutable objects are stored in the pair, then
the pair itself effectively becomes mutable.
ThreadSafe if both paired objects are thread-safe
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
compare
(Comparable original, Comparable other) int
compareTo
(ImmutablePair<L, R> o) Compares the pair based on the left element followed by the right element.boolean
final L
getKey()
getLeft()
getRight()
getValue()
int
hashCode()
This is not allowed since the pair itself is immutable.toString()
-
Field Details
-
left
-
right
-
-
Constructor Details
-
ImmutablePair
Create a pair of elements.- Parameters:
left
- the left elementright
- the right element
-
-
Method Details
-
getLeft
- Returns:
- the left element
-
getRight
- Returns:
- the right element
-
getKey
-
getValue
-
setValue
This is not allowed since the pair itself is immutable.- Specified by:
setValue
in interfaceMap.Entry<L,
R> - Returns:
- never
- Throws:
UnsupportedOperationException
-
compareTo
Compares the pair based on the left element followed by the right element. The types must beComparable
.- Specified by:
compareTo
in interfaceComparable<L>
- Parameters:
other
- the other pair, not null- Returns:
- negative if this is less, zero if equal, positive if greater
-
compare
-
equals
-
hashCode
public int hashCode() -
toString
-