public class JsonComparator extends Object implements Comparator<JSONObject>
StringUtil.getCollator()
will be usedStringUtil.getCollator()
Constructor and Description |
---|
JsonComparator(String attributes)
Creates a new comparator object to sort according to the passed attributes
|
JsonComparator(String[] attributes)
Creates a new comparator object to sort according to the passed attributes
|
Modifier and Type | Method and Description |
---|---|
int |
compare(JSONObject a,
JSONObject b) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public JsonComparator(String attributes)
attributes
- the name of the attributes by which sorting should be performed, e.g. "firstAttr,-secondAttr" means
first sort ascending by 'firstAttr' and then (if necessary) sort descending by 'secondAttr'public JsonComparator(String[] attributes)
attributes
- the name of the attributes by which sorting should be performed, e.g. ["firstAttr","-secondAttr"] means
first sort ascending by 'firstAttr' and then (if necessary) sort descending by 'secondAttr'public int compare(JSONObject a, JSONObject b)
compare
in interface Comparator<JSONObject>
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.