it.unimi.dsi.fastutil.chars
Class AbstractCharComparator

java.lang.Object
  extended by it.unimi.dsi.fastutil.chars.AbstractCharComparator
All Implemented Interfaces:
CharComparator, Comparator<Character>

public abstract class AbstractCharComparator
extends Object
implements CharComparator

An abstract class facilitating the creation of type-specific comparators.

To create a type-specific comparator you need both a method comparing primitive types and a method comparing objects. However, if you have the first one you can just inherit from this class and get for free the second one.

See Also:
Comparator

Constructor Summary
protected AbstractCharComparator()
           
 
Method Summary
 int compare(Character ok1, Character ok2)
           
abstract  int compare(char k1, char k2)
          Compares the given primitive types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

AbstractCharComparator

protected AbstractCharComparator()
Method Detail

compare

public int compare(Character ok1,
                   Character ok2)
Specified by:
compare in interface Comparator<Character>

compare

public abstract int compare(char k1,
                            char k2)
Description copied from interface: CharComparator
Compares the given primitive types.

Specified by:
compare in interface CharComparator
Returns:
A positive integer, zero, or a negative integer if the first argument is greater than, equal to, or smaller than, respectively, the second one.
See Also:
Comparator


Copyright © 2011. All Rights Reserved.