L
- the type of the left elementR
- the type of the right elementpublic class ImmutablePair<L,R> extends Object implements Map.Entry<L,R>, Serializable, Comparable<ImmutablePair<L,R>>
Constructor and Description |
---|
ImmutablePair(L left,
R right)
Create a pair of elements.
|
Modifier and Type | Method and Description |
---|---|
protected 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 |
equals(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.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
public L getLeft()
public R getRight()
public R setValue(R value)
setValue
in interface Map.Entry<L,R>
UnsupportedOperationException
public int compareTo(ImmutablePair<L,R> o)
Comparable
.compareTo
in interface Comparable<ImmutablePair<L,R>>
other
- the other pair, not nullprotected int compare(Comparable original, Comparable other)
public boolean equals(Object obj)
public int hashCode()
Copyright © 2022. All rights reserved.