com.jidesoft.comparator
Class CharSequenceComparator
java.lang.Object
com.jidesoft.comparator.CharSequenceComparator
- All Implemented Interfaces:
- Serializable, Comparator<Object>
public class CharSequenceComparator
- extends Object
- implements Comparator<Object>, Serializable
A Comparator that compares CharSequence objects (including String and StringBuffer as both extend CharSequence.
Throws ClassCastExceptions if the objects are not CharSequence, or if they are null. If both objects are null, they
will be treated as equal. If one is null and the other is not, the null value will be treated as smaller then
non-null value.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONTEXT
public static final ComparatorContext CONTEXT
CONTEXT_IGNORE_CASE
public static final ComparatorContext CONTEXT_IGNORE_CASE
CharSequenceComparator
public CharSequenceComparator()
- Constructs a CharSequenceComparator.
CharSequenceComparator
public CharSequenceComparator(boolean caseSensitive)
isCaseSensitive
public boolean isCaseSensitive()
- Checks if the case is sensitive when comparing.
- Returns:
- true if the comparator is case sensitive.
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
- Sets the case sensitive flag. By default, it's true meaning the comparator is case sensitive.
- Parameters:
caseSensitive
- true or false.
compare
public int compare(Object o1,
Object o2)
- Specified by:
compare
in interface Comparator<Object>