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:
java.io.Serializable
,java.lang.Comparable<ImmutablePair<L,R>>
,java.util.Map.Entry<L,R>
public class ImmutablePair<L,R> extends java.lang.Object implements java.util.Map.Entry<L,R>, java.io.Serializable, java.lang.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ImmutablePair(L left, R right)
Create a pair of elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
compare(java.lang.Comparable original, java.lang.Comparable other)
int
compareTo(ImmutablePair<L,R> o)
Compares the pair based on the left element followed by the right element.boolean
equals(java.lang.Object obj)
L
getKey()
L
getLeft()
R
getRight()
R
getValue()
int
hashCode()
R
setValue(R value)
This is not allowed since the pair itself is immutable.java.lang.String
toString()
-
-
-
Method Detail
-
getLeft
public L getLeft()
- Returns:
- the left element
-
getRight
public R getRight()
- Returns:
- the right element
-
compareTo
public int compareTo(ImmutablePair<L,R> o)
Compares the pair based on the left element followed by the right element. The types must beComparable
.- Specified by:
compareTo
in interfacejava.lang.Comparable<L>
- Parameters:
other
- the other pair, not null- Returns:
- negative if this is less, zero if equal, positive if greater
-
compare
protected int compare(java.lang.Comparable original, java.lang.Comparable other)
-
equals
public boolean equals(java.lang.Object obj)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-