Class CaseInsensitiveOrder

java.lang.Object
com.codename1.util.CaseInsensitiveOrder
All Implemented Interfaces:
Comparator<String>

public class CaseInsensitiveOrder extends Object implements Comparator<String>
A string comparator equivalent to String.CASE_INSENSITIVE_ORDER which isn't available in Codename One
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares the two specified objects to determine their relative ordering.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

    Methods inherited from interface Comparator

    equals
    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Compares this Comparator with the specified Object and indicates whether they are equal.
  • Constructor Details

    • CaseInsensitiveOrder

      public CaseInsensitiveOrder()
  • Method Details

    • compare

      public int compare(String s1, String s2)
      Compares the two specified objects to determine their relative ordering. The ordering implied by the return value of this method for all possible pairs of (object1, object2) should form an equivalence relation. This means that
      • compare(a,a) returns zero for all a
      • the sign of compare(a,b) must be the opposite of the sign of compare(b,a) for all pairs of (a,b)
      • From compare(a,b) > 0 and compare(b,c) > 0 it must follow compare(a,c) > 0 for all possible combinations of (a,b,c)
      Specified by:
      compare in interface Comparator<String>
      Parameters:
      s1 - an Object.
      s2 - a second Object to compare with object1.
      Returns:
      an integer invalid input: '<' 0 if object1 is less than object2, 0 if they are equal, and > 0 if object1 is greater than object2.