public class Pair<L,R>
extends java.lang.Object
implements java.io.Serializable
A convenience class to represent name-value pairs.
copy from javafx.util.Pair,and refer to org.apache.commons.lang3.tuple.Pair| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(java.lang.Object o)
Test this
Pair for equality with another
Object. |
L |
getKey()
Gets the left for this pair.
|
L |
getLeft()
Gets the left element from this pair.
|
R |
getRight()
Gets the right element from this pair.
|
R |
getValue()
Gets the value for this pair.
|
int |
hashCode()
Generate a hash code for this
Pair. |
static <L,R> Pair<L,R> |
of(L left,
R right)
Obtains an pair of from two objects inferring the generic types.
|
java.lang.String |
toString()
String representation of this
Pair. |
public L getLeft()
Gets the left element from this pair.
When treated as a left-value pair, this is the left.
public R getRight()
Gets the right element from this pair.
When treated as a left-value pair, this is the value.
public L getKey()
public R getValue()
public java.lang.String toString()
String representation of this
Pair.
The default name/value delimiter '=' is always used.
toString 在类中 java.lang.ObjectString representation of this Pairpublic int hashCode()
Generate a hash code for this Pair.
The hash code is calculated using both the name and
the value of the Pair.
hashCode 在类中 java.lang.ObjectPairpublic boolean equals(java.lang.Object o)
Test this Pair for equality with another
Object.
If the Object to be tested is not a
Pair or is null, then this method
returns false.
Two Pairs are considered equal if and only if
both the names and values are equal.
equals 在类中 java.lang.Objecto - the Object to test for
equality with this Pairtrue if the given Object is
equal to this Pair else falsepublic static <L,R> Pair<L,R> of(L left, R right)
Obtains an pair of from two objects inferring the generic types.
This factory allows the pair to be created using inference to obtain the generic types.
L - the left element typeR - the right element typeleft - the left element, may be nullright - the right element, may be nullCopyright © 2023. All Rights Reserved.