|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.myjavatools.lib.foundation.Pair<Left,Right>
public class Pair<Left,Right>
Pair<Left, Right> is a class that represents pairs of objects. It is similar to Map.Entry. Pair is immutable.
Map#Entry| Field Summary | |
|---|---|
protected Left |
left
|
protected Right |
right
|
| Constructor Summary | |
|---|---|
Pair(Left left,
Right right)
Constructor, creates a new pair from two objects. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object x)
equals method |
Left |
getKey()
key getter (to implement Map.Entry) |
Right |
getValue()
value getter (to implement Map.Entry) |
int |
hashCode()
some hashcode for Pair made from left and right hash codes |
protected static int |
hashCode(java.util.Map.Entry pair)
|
Left |
left()
left getter |
protected static boolean |
pairEqual(java.util.Map.Entry pair1,
java.util.Map.Entry pair2)
|
Right |
right()
right getter |
Right |
setValue(Right value)
value setter - unsupported (immutable class) |
Pair<Right,Left> |
swap()
swaps left and right |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Left left
protected Right right
| Constructor Detail |
|---|
public Pair(Left left,
Right right)
left - Leftright - Right| Method Detail |
|---|
public Right setValue(Right value)
setValue in interface java.util.Map.Entry<Left,Right>value - Right ignored
java.lang.UnsupportedOperationException - - alwayspublic Right getValue()
getValue in interface java.util.Map.Entry<Left,Right>public Left getKey()
getKey in interface java.util.Map.Entry<Left,Right>
protected static boolean pairEqual(java.util.Map.Entry pair1,
java.util.Map.Entry pair2)
public boolean equals(java.lang.Object x)
equals in interface java.util.Map.Entry<Left,Right>equals in class java.lang.Objectx - Object to compare to
protected static int hashCode(java.util.Map.Entry pair)
public int hashCode()
hashCode in interface java.util.Map.Entry<Left,Right>hashCode in class java.lang.Objectpublic Left left()
public Right right()
public Pair<Right,Left> swap()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||