oracle.javatools.db.diff
Class GenericComparator
java.lang.Object
oracle.javatools.db.diff.GenericComparator
- All Implemented Interfaces:
- java.util.Comparator
public class GenericComparator
- extends java.lang.Object
- implements java.util.Comparator
Generic comparator for use comparing lists of objects. Compares using the
following rules (in order):
- If both objects are Comparable, they are compared using the Comparable
interface
- If the object is convertible to a string using the javatools
ToStringManager the string representation is compared.
- toString is used to create a String representation that is then compared.
For non primitive objects, this Comparator is only designed to compare lists
that contains objects all of the same class.
When dealing with numbers, a String representation of a number, and its
Number representation will equate, as will different Number implementations.
i.e. "1"
, 1
and 1D
are all the same to
this Comparator, but all number representations will compare in numerical,
not alphabetical order so "10" is greater than "2".
- Since:
- 11
Method Summary |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
|
boolean |
equals(java.lang.Object obj)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenericComparator
public GenericComparator()
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Specified by:
compare
in interface java.util.Comparator
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interface java.util.Comparator
- Overrides:
equals
in class java.lang.Object
Copyright © 1997, 2011, Oracle. All rights reserved.