org.mozilla.javascript

## Class ScriptableObject.KeyComparator

- java.lang.Object
- - org.mozilla.javascript.ScriptableObject.KeyComparator

- All Implemented Interfaces:
    java.util.Comparator<java.lang.Object>
  Enclosing class:
    ScriptableObject

      public static final class ScriptableObject.KeyComparator
      extends java.lang.Object
      implements java.util.Comparator<java.lang.Object>

  This comparator sorts property fields in spec-compliant order. Numeric ids first, in numeric order, followed by string ids, in insertion order. Since this class already keeps string keys in insertion-time order, we treat all as equal. The "Arrays.sort" method will then not change their order, but simply move all the numeric properties to the front, since this method is defined to be stable.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyComparator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(java.lang.Object o1, java.lang.Object o2)`

    - ### 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

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### KeyComparator

          public KeyComparator()

  - ### Method Detail

    - #### compare

          public int compare(java.lang.Object o1,
                             java.lang.Object o2)

      Specified by:
        `compare` in interface `java.util.Comparator<java.lang.Object>`