Class Pair<K,V>
java.lang.Object
org.apache.commons.math3.util.Pair<K,V>
- Type Parameters:
K- Key type.V- Value type.
- Direct Known Subclasses:
PointValuePair, PointValuePair, PointVectorValuePair, PointVectorValuePair
Generic pair.
Although the instances of this class are immutable, it is impossible to ensure that the references passed to the constructor will not be modified by the caller.
Although the instances of this class are immutable, it is impossible to ensure that the references passed to the constructor will not be modified by the caller.
- Since:
- 3.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> Pair <K, V> create(K k, V v) Convenience factory method that calls theconstructor.booleanCompare the specified object with this entry for equality.getFirst()Get the first element of the pair.getKey()Get the key.Get the second element of the pair.getValue()Get the value.inthashCode()Compute a hash code.toString()
-
Field Details
-
key
Key. -
value
Value.
-
-
Constructor Details
-
Pair
-
Pair
-
-
Method Details
-
getKey
-
getValue
-
getFirst
Get the first element of the pair.- Returns:
- the first element of the pair.
- Since:
- 3.1
-
getSecond
Get the second element of the pair.- Returns:
- the second element of the pair.
- Since:
- 3.1
-
equals
-
hashCode
-
toString
-
create
Convenience factory method that calls theconstructor.- Type Parameters:
K- the key typeV- the value type- Parameters:
k- First element of the pair.v- Second element of the pair.- Returns:
- a new
Paircontainingkandv. - Since:
- 3.3
-