- private JsonArray getSones(Set<Sone> sones) {
- JsonArray soneArray = new JsonArray();
- List<Sone> sortedSones = new ArrayList<Sone>(sones);
- Collections.sort(sortedSones, Sone.NICE_NAME_COMPARATOR);
- for (Sone sone : sortedSones) {
- soneArray.add(new JsonObject().put("id", sone.getId()).put("name", SoneAccessor.getNiceName(sone)));
+ private static JsonNode getSones(Set<Sone> sones) {
+ ArrayNode soneArray = new ArrayNode(instance);
+ for (Sone sone : FluentIterable.from(sones).toSortedList(NICE_NAME_COMPARATOR)) {
+ soneArray.add(new ObjectNode(instance).put("id", sone.getId()).put("name", SoneAccessor.getNiceName(sone)));