java.lang.Object
org.jgrapht.alg.util.Pair<A,B>
- Type Parameters:
A
- the first element typeB
- the second element type
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
UnorderedPair
Generic pair.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getFirst()
Get the first element of the pairGet the second element of the pair<E> boolean
hasElement
(E e) Assess if this pair contains an element.int
hashCode()
static <A,
B> Pair<A, B> of
(A a, B b) Create a new pair.void
Set the first element of the pair.void
Set the second element of the pair.toString()
-
Field Details
-
first
The first pair element -
second
The second pair element
-
-
Constructor Details
-
Pair
Create a new pair- Parameters:
a
- the first elementb
- the second element
-
-
Method Details
-
getFirst
Get the first element of the pair- Returns:
- the first element of the pair
-
getSecond
Get the second element of the pair- Returns:
- the second element of the pair
-
setFirst
Set the first element of the pair.- Parameters:
f
- the element to be assigned.
-
setSecond
Set the second element of the pair.- Parameters:
s
- the element to be assigned.
-
hasElement
public <E> boolean hasElement(E e) Assess if this pair contains an element.- Type Parameters:
E
- the element type- Parameters:
e
- The element in question- Returns:
- true if contains the element, false otherwise
-
toString
-
equals
-
hashCode
public int hashCode() -
of
Create a new pair.- Type Parameters:
A
- the first element typeB
- the second element type- Parameters:
a
- first elementb
- second element- Returns:
- new pair
-