org.openadaptor.util.comparator
Class IntegerComparator

java.lang.Object
  extended by org.openadaptor.util.comparator.IntegerComparator
All Implemented Interfaces:
java.util.Comparator

public class IntegerComparator
extends java.lang.Object
implements java.util.Comparator

For JDK 1.1 compatibility, we need to provide our own Integer comparator to avoid a ClassCastException when using collections for JDK 1.1.

This is because java.lang.String implements java.util.Comparable but Collections for JDK 1.1 is expecting an object which implements com.sun.java.util.collections.Comparable.


Constructor Summary
IntegerComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Provide the essential implementation of compare() method.
 boolean equals(java.lang.Object obj)
          Provide implementation of equals.
static IntegerComparator getInstance()
          Provide access to a IntegerComparator instance
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerComparator

public IntegerComparator()
Method Detail

getInstance

public static IntegerComparator getInstance()
Provide access to a IntegerComparator instance


compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Provide the essential implementation of compare() method.

Specified by:
compare in interface java.util.Comparator

equals

public boolean equals(java.lang.Object obj)
Provide implementation of equals.

This method is not actually used in our context.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object