E
- the type of the first elementF
- the type of the second elementpublic class Pair<E,F>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) E |
obj1
The first element of this pair
|
(package private) F |
obj2
The second element of this pair
|
Constructor and Description |
---|
Pair()
Initializes an empty pair.
|
Pair(E obj1,
F obj2)
Initializes the elements of this pair with the given parameters
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
E |
getFirst()
returns the first element of this pair
|
F |
getSecond()
returns the second element of this pair
|
int |
hashCode() |
void |
setFirst(E obj1)
sets the first element of this pair
|
void |
setSecond(F obj2)
sets the second element of this pair
|
java.lang.String |
toString()
returns a string representation of a pair as "(obj1, obj2)"
|
public E getFirst()
public void setFirst(E obj1)
obj1
- an object of type Epublic F getSecond()
public void setSecond(F obj2)
obj2
- an object of type Fpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object