E1
- First element of this pair.E2
- Second element of this pair.public final class Pair<E1,E2>
extends java.lang.Object
Constructor and Description |
---|
Pair(E1 firstElement,
E2 secondElement)
Create a new pair out of two elements.
|
Pair(java.util.Map.Entry<E1,E2> entry)
Create a new pair out of a
Map.Entry object. |
Modifier and Type | Method and Description |
---|---|
E1 |
getKey()
Get the first element of this pair.
|
E2 |
getValue()
Get the second element of this pair.
|
void |
setKey(E1 element)
Set the first element of this pair.
|
void |
setValue(E2 element)
Set the second element of this pair.
|
java.lang.String |
toString() |
public Pair(java.util.Map.Entry<E1,E2> entry)
Map.Entry
object.entry
- The entry to create the pair from.public E1 getKey()
public void setKey(E1 element)
element
- The new element to set.public E2 getValue()
public void setValue(E2 element)
element
- The new element to set.public java.lang.String toString()
toString
in class java.lang.Object