Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.Pair<FIRST,
- All Implemented Interfaces:
Serializable
public final class Pair<FIRST,SECOND> extends Object implements Serializable
A pair of two (possibly
Overrides
Objects of this class are immutable: they have no setter methods.
null
) elements, may be used as key in maps.Overrides
equals(Object)
and hashCode()
.Objects of this class are immutable: they have no setter methods.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
Pair |
Creates a new pair of two elements
|
Modifier and Type | Method | Description |
---|---|---|
Object | clone() | |
boolean | equals | |
FIRST | getFirst() |
Returns the first (left) element from this pair
|
SECOND | getSecond() |
Returns the second (right) element from this pair
|
int | hashCode() | |
static <F, | of |
Creates and returns new pair of two elements
|
String | toString() |
public Pair(FIRST first, SECOND second)
Creates a new pair of two elements
- Parameters:
first
- the first (left) element, may benull
second
- the second (right) element, may benull
public static <F,S> Pair<F,S> of(F first, S second)
Creates and returns new pair of two elements
- Parameters:
first
- the first (left) element, may benull
second
- the second (right) element, may benull
- Returns:
- a pair, never
null
public FIRST getFirst()
Returns the first (left) element from this pair
- Returns:
- the first element from this pair, may be
null
public SECOND getSecond()
Returns the second (right) element from this pair
- Returns:
- the second element from this pair, may be
null
public int hashCode()
public boolean equals(Object obj)
public Object clone() throws CloneNotSupportedException
- Throws:
CloneNotSupportedException
public String toString()