|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the type of the key arguments of the comparisonO
- the type of the object arguments of the comparisonpublic interface IndexComparator<K,O>
A comparison function, which imposes a total ordering on some
collection of keys. Objects stored in the index are compared using
keys for ordering; the extractKey(O)
extracts a key for this
comparator from any indexed object.
Comparator
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this comparator. |
K |
extractKey(O object)
Returns the key (used for comparison) from an indexed object. |
int |
indexCompare(K k,
O o)
Compares its two arguments for order. |
Methods inherited from interface java.util.Comparator |
---|
compare |
Method Detail |
---|
int indexCompare(K k, O o)
k
- the key to compareo
- the object to be compared
java.lang.ClassCastException
- if the arguments' types prevent them from
being compared by this comparator.K extractKey(O object)
object
- the indexed (full) object
boolean equals(java.lang.Object obj)
Object.equals(Object)
. Additionally, this method can return
true only if the specified object is also a comparator
and it imposes the same ordering as this comparator. Thus,
comp1.equals(comp2)
implies that sgn(comp1.indexCompare(o1,
o2))==sgn(comp2.indexCompare(o1, o2)) for every object reference
o1 and o2.Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct comparators impose the same order.
equals
in interface java.util.Comparator<K>
equals
in class java.lang.Object
obj
- the reference object with which to compare.
true
only if the specified object is also
a comparator and it imposes the same ordering as this
comparator.Object.equals(Object)
,
Object.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |