Package com.groiss.ds
Class ComparablePair<F extends Comparable<F>,S>
java.lang.Object
com.groiss.ds.Pair<F,S>
com.groiss.ds.ComparablePair<F,S>
- All Implemented Interfaces:
KeyValuePair<F,
,S> Serializable
,Comparable<ComparablePair<F,
?>>
public class ComparablePair<F extends Comparable<F>,S>
extends Pair<F,S>
implements Comparable<ComparablePair<F,?>>
The comparable pair represents a pair of a key and a value. The key is used for comparing, the
value is used for the toString method. This is useful if you want to sort a list be the keys and
show the values. For example: new ComparablePair(dateval, CalUtil.showDate(dateval))
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ComparablePair
Constructor with key and value- Parameters:
key
-value
-
-
-
Method Details
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<F extends Comparable<F>>
-
equals
Description copied from class:Pair
Returnstrue
ifobj
is also a Pair and contains two objects equal to the two objects of this Pair.null
references are considered as equal, too. -
hashCode
public int hashCode()Description copied from class:Pair
Builds a new hash code out of the two objects' hash codes.
-