Package libai.common
Class Pair<V extends java.lang.Comparable<V>,K>
- java.lang.Object
-
- libai.common.Pair<V,K>
-
- All Implemented Interfaces:
java.lang.Comparable<Pair<V,K>>
public final class Pair<V extends java.lang.Comparable<V>,K> extends java.lang.Object implements java.lang.Comparable<Pair<V,K>>
Pair class allows to keep two elements of possibly different types in the same structure and can be used for keep pairs key-value.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Pair<V,K> o)Compare two pairs by the first element.booleanequals(java.lang.Object obj)inthashCode()java.lang.StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(Pair<V,K> o)
Compare two pairs by the first element. The first element type must implement the Comparable interface.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-