com.groiss.ds
Class ComparablePair<F extends java.lang.Comparable<F>,S>
java.lang.Object
com.groiss.ds.Pair<F,S>
com.groiss.ds.ComparablePair<F,S>
- All Implemented Interfaces:
- KeyValuePair<F,S>, java.io.Serializable, java.lang.Comparable<ComparablePair<F,?>>
public class ComparablePair<F extends java.lang.Comparable<F>,S>
- extends Pair<F,S>
- implements java.lang.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:
- Serialized Form
Constructor Summary |
ComparablePair(F key,
S value)
Constructor with key and value |
Method Summary |
int |
compareTo(ComparablePair<F,?> o)
|
boolean |
equals(java.lang.Object obj)
Returns true if obj is also a Pair and contains two
objects equal to the two objects of this Pair. |
int |
hashCode()
Builds a new hash code out of the two objects' hash codes. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ComparablePair
public ComparablePair(F key,
S value)
- Constructor with key and value
- Parameters:
key
- value
-
toString
public java.lang.String toString()
- Overrides:
toString
in class Pair<F extends java.lang.Comparable<F>,S>
compareTo
public int compareTo(ComparablePair<F,?> o)
- Specified by:
compareTo
in interface java.lang.Comparable<ComparablePair<F extends java.lang.Comparable<F>,?>>
equals
public boolean equals(java.lang.Object obj)
- Description copied from class:
Pair
- Returns
true
if obj
is also a Pair and contains two
objects equal to the two objects of this Pair. null
references are
considered as equal, too.
- Overrides:
equals
in class Pair<F extends java.lang.Comparable<F>,S>
hashCode
public int hashCode()
- Description copied from class:
Pair
- Builds a new hash code out of the two objects' hash codes.
- Overrides:
hashCode
in class Pair<F extends java.lang.Comparable<F>,S>
@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.