gshute.util
Class Comparators

java.lang.Object
  |
  +--gshute.util.Comparators

public class Comparators
extends java.lang.Object

Class Comparators is a factory class that provides comparators for comparing Byte, Double, Float, Integer, Long, Short, and String objects. All comparators returned by this class are singletons.


Field Summary
protected static java.lang.String BYTE
           
protected static java.lang.String BYTE_REVERSED
           
protected static java.util.Hashtable comparators
           
protected static java.lang.String DOUBLE
           
protected static java.lang.String DOUBLE_REVERSED
           
protected static java.lang.String FLOAT
           
protected static java.lang.String FLOAT_REVERSED
           
protected static java.lang.String INTEGER
           
protected static java.lang.String INTEGER_REVERSED
           
protected static java.lang.String LONG
           
protected static java.lang.String LONG_REVERSED
           
protected static java.lang.String SHORT
           
protected static java.lang.String SHORT_REVERSED
           
protected static java.lang.String STRING
           
protected static java.lang.String STRING_REVERSED
           
 
Constructor Summary
Comparators()
           
 
Method Summary
static java.util.Comparator forByte()
          Comparators.forByte() returns a comparator for the Byte class.
static java.util.Comparator forByteReversed()
          Comparators.forByteReversed() returns a reverse order comparator for the Byte class.
static java.util.Comparator forDouble()
          Comparators.forDouble() returns a comparator for the Double class.
static java.util.Comparator forDoubleReversed()
          Comparators.forDoubleReversed() returns a reverse order comparator for the Double class.
static java.util.Comparator forFloat()
          Comparators.forFloat() returns a comparator for the Float class.
static java.util.Comparator forFloatReversed()
          Comparators.forFloatReversed() returns a reverse order comparator for the Float class.
static java.util.Comparator forInteger()
          Comparators.forInteger() returns a comparator for the Integer class.
static java.util.Comparator forIntegerReversed()
          Comparators.forIntegerReversed() returns a reverse order comparator for the Integer class.
static java.util.Comparator forLong()
          Comparators.forLong() returns a comparator for the Long class.
static java.util.Comparator forLongReversed()
          Comparators.forLongReversed() returns a reverse order comparator for the Long class.
static java.util.Comparator forShort()
          Comparators.forShort() returns a comparator for the Short class.
static java.util.Comparator forShortReversed()
          Comparators.forShortReversed() returns a reverse order comparator for the Short class.
static java.util.Comparator forString()
          Comparators.forString() returns a comparator for the String class.
static java.util.Comparator forStringReversed()
          Comparators.forStringReversed() returns a reverse order comparator for the String class.
static java.util.Comparator resolved(java.util.Comparator c1, java.util.Comparator c2)
          Comparators.resolved(c1, c2) returns a comparator whose compare() method returns the same result as c1.compare() except that ties are resolved by c2.compare().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparators

protected static java.util.Hashtable comparators

BYTE

protected static final java.lang.String BYTE

BYTE_REVERSED

protected static final java.lang.String BYTE_REVERSED

DOUBLE

protected static final java.lang.String DOUBLE

DOUBLE_REVERSED

protected static final java.lang.String DOUBLE_REVERSED

FLOAT

protected static final java.lang.String FLOAT

FLOAT_REVERSED

protected static final java.lang.String FLOAT_REVERSED

INTEGER

protected static final java.lang.String INTEGER

INTEGER_REVERSED

protected static final java.lang.String INTEGER_REVERSED

LONG

protected static final java.lang.String LONG

LONG_REVERSED

protected static final java.lang.String LONG_REVERSED

SHORT

protected static final java.lang.String SHORT

SHORT_REVERSED

protected static final java.lang.String SHORT_REVERSED

STRING

protected static final java.lang.String STRING

STRING_REVERSED

protected static final java.lang.String STRING_REVERSED
Constructor Detail

Comparators

public Comparators()
Method Detail

forByte

public static java.util.Comparator forByte()
Comparators.forByte() returns a comparator for the Byte class.

forByteReversed

public static java.util.Comparator forByteReversed()
Comparators.forByteReversed() returns a reverse order comparator for the Byte class.

forDouble

public static java.util.Comparator forDouble()
Comparators.forDouble() returns a comparator for the Double class.

forDoubleReversed

public static java.util.Comparator forDoubleReversed()
Comparators.forDoubleReversed() returns a reverse order comparator for the Double class.

forFloat

public static java.util.Comparator forFloat()
Comparators.forFloat() returns a comparator for the Float class.

forFloatReversed

public static java.util.Comparator forFloatReversed()
Comparators.forFloatReversed() returns a reverse order comparator for the Float class.

forInteger

public static java.util.Comparator forInteger()
Comparators.forInteger() returns a comparator for the Integer class.

forIntegerReversed

public static java.util.Comparator forIntegerReversed()
Comparators.forIntegerReversed() returns a reverse order comparator for the Integer class.

forLong

public static java.util.Comparator forLong()
Comparators.forLong() returns a comparator for the Long class.

forLongReversed

public static java.util.Comparator forLongReversed()
Comparators.forLongReversed() returns a reverse order comparator for the Long class.

forShort

public static java.util.Comparator forShort()
Comparators.forShort() returns a comparator for the Short class.

forShortReversed

public static java.util.Comparator forShortReversed()
Comparators.forShortReversed() returns a reverse order comparator for the Short class.

forString

public static java.util.Comparator forString()
Comparators.forString() returns a comparator for the String class.

forStringReversed

public static java.util.Comparator forStringReversed()
Comparators.forStringReversed() returns a reverse order comparator for the String class.

resolved

public static java.util.Comparator resolved(java.util.Comparator c1,
                                            java.util.Comparator c2)
Comparators.resolved(c1, c2) returns a comparator whose compare() method returns the same result as c1.compare() except that ties are resolved by c2.compare().