org.sonar.duplications.utils
Class FastStringComparator
java.lang.Object
org.sonar.duplications.utils.FastStringComparator
- All Implemented Interfaces:
- Comparator<String>
public final class FastStringComparator
- extends Object
- implements Comparator<String>
More efficient (in terms of performance) implementation of a String comparator.
Speed is gained by using hash code as a primary comparison attribute, which is cached for String.
Be aware that this ordering is not lexicographic, however stable.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final FastStringComparator INSTANCE
compare
public int compare(String s1,
String s2)
- Compares two strings (not lexicographically).
- Specified by:
compare
in interface Comparator<String>
Copyright © 2009-2012 SonarSource. All Rights Reserved.