edu.nps.moves.examples
Class ClassNameComparator
java.lang.Object
edu.nps.moves.examples.ClassNameComparator
- All Implemented Interfaces:
- java.util.Comparator<Pdu>
public class ClassNameComparator
- extends java.lang.Object
- implements java.util.Comparator<Pdu>
A comparator that is used by the java util classes for sorting. This
sorts members of a collection by class name.
Used like so:
Collections.sort(aList, new ClassNameComparator());
- Version:
- $Id:$
- Author:
- DMcG
Method Summary |
int |
compare(Pdu object1,
Pdu object2)
Returns a number less than, equal to, or greater than zero,
depending on whether the object is lexically less than, equal to,
or greater than the other object. |
boolean |
equals(java.lang.Object obj)
Returns true if this comparator is the same class as the comparator passed in. |
int |
hashCode()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
ClassNameComparator
public ClassNameComparator()
compare
public int compare(Pdu object1,
Pdu object2)
- Returns a number less than, equal to, or greater than zero,
depending on whether the object is lexically less than, equal to,
or greater than the other object.
- Specified by:
compare
in interface java.util.Comparator<Pdu>
- Parameters:
object1
- object2
-
equals
public boolean equals(java.lang.Object obj)
- Returns true if this comparator is the same class as the comparator passed in.
- Specified by:
equals
in interface java.util.Comparator<Pdu>
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
-
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object