reversing array etc
Closed this issue · 2 comments
karussell commented
Would be nice if there would be support for reversing an array (or also other sorted collections?)
public static JsonArray reverse(JsonArray arr) {
JsonArray res = new JsonArray();
for (int i = arr.size() - 1; i >= 0; i--) {
JsonElement el = arr.get(i);
res.add(el);
}
return res;
}
jillesvangurp commented
You should be able to use Collections.reverse or Collections.sort.
karussell commented
oh, ok