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:
- 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 intcompare(Comparable original, Comparable other)intcompareTo(ImmutablePair<L,R> o)Compares the pair based on the left element followed by the right element.booleanequals(Object obj)LgetKey()LgetLeft()RgetRight()RgetValue()inthashCode()RsetValue(R value)This is not allowed since the pair itself is immutable.StringtoString()
-
-
-
Method Detail
-
getLeft
public L getLeft()
- Returns:
- the left element
-
getRight
public R getRight()
- Returns:
- the right element
-
setValue
public R setValue(R value)
This is not allowed since the pair itself is immutable.- Specified by:
setValuein interfaceMap.Entry<L,R>- Returns:
- never
- Throws:
UnsupportedOperationException
-
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:
compareToin interfaceComparable<L>- Parameters:
other- the other pair, not null- Returns:
- negative if this is less, zero if equal, positive if greater
-
compare
protected int compare(Comparable original, Comparable other)
-
equals
public boolean equals(Object obj)
-
hashCode
public int hashCode()
-
-