Package org.hipparchus.util
Class Pair<K,V>
java.lang.Object
org.hipparchus.util.Pair<K,V>
- Type Parameters:
K- Key type.V- Value type.
- Direct Known Subclasses:
PointValuePair,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.
-
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()
-
Constructor Details
-
Method Details
-
getKey
Get the key.- Returns:
- the key (first element of the pair).
-
getValue
Get the value.- Returns:
- the value (second element of the pair).
-
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.
-
equals
Compare the specified object with this entry for equality. -
hashCode
public int hashCode()Compute a hash code. -
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.
-