JIDE 3.5.15

com.jidesoft.comparator
Class CharSequenceComparator

java.lang.Object
  extended by 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

Field Summary
static ComparatorContext CONTEXT
           
static ComparatorContext CONTEXT_IGNORE_CASE
           
 
Constructor Summary
CharSequenceComparator()
          Constructs a CharSequenceComparator.
CharSequenceComparator(boolean caseSensitive)
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 boolean isCaseSensitive()
          Checks if the case is sensitive when comparing.
 void setCaseSensitive(boolean caseSensitive)
          Sets the case sensitive flag.
 
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
 

Field Detail

CONTEXT

public static final ComparatorContext CONTEXT

CONTEXT_IGNORE_CASE

public static final ComparatorContext CONTEXT_IGNORE_CASE
Constructor Detail

CharSequenceComparator

public CharSequenceComparator()
Constructs a CharSequenceComparator.


CharSequenceComparator

public CharSequenceComparator(boolean caseSensitive)
Method Detail

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>

JIDE 3.5.15