edu.tum.cs.commons.string
Class FastStringComparator
java.lang.Object
edu.tum.cs.commons.string.FastStringComparator
- All Implemented Interfaces:
- java.util.Comparator<java.lang.String>
public class FastStringComparator
- extends java.lang.Object
- implements java.util.Comparator<java.lang.String>
This is a more efficient implementation of a String comparator. While the
comparison order is stable, there is no guarantee that is is lexicographic.
The additional speed is gained by using the hash code as primary comparison
attribute. As the hash code is cached by the string object, its access is
very cheap even for long strings.
- Version:
- $Rev: 28495 $
- Author:
- hummelb, $Author: deissenb $
- Rating:
- GREEN Hash: 377662AA56158F4D3E09C59056FBDEED
Method Summary |
int |
compare(java.lang.String s0,
java.lang.String s1)
|
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 |
INSTANCE
public static final FastStringComparator INSTANCE
- Singleton instance.
FastStringComparator
public FastStringComparator()
compare
public int compare(java.lang.String s0,
java.lang.String s1)
-
- Specified by:
compare
in interface java.util.Comparator<java.lang.String>
TUM CCSM Commons - 2.7