Mult { public String order(String startSubscript, int direction) { if (startSubscript.length() == 0) { if (direction > 0) return getFirst(); else return getLast(); } else { if (direction > 0) { String next = (String) multiple.nextKey(startSubscript); return next != null ? next : ""; } else { String prev = (String) multiple.previousKey(startSubscript); return prev != null ? prev : ""; } } }  int getCount(); String order(String startSubscript, int direction); String get(String subscript); void put(String subscript, String value); void add(Map map); void add(List list); void add(JsonNode jsonNode); int position(String subscript); String subscript(int position); String getFirst(); String getLast(); Map<String, Object> toMap(); @JsonValue JsonNode toJsonNode(); @Override boolean equals(Object o); @Override int hashCode(); static Mult create(Map map); static Mult create(List list); static Mult create(JsonNode json);  }
@Test public void testOrder() { m.put("foo", "fred"); m.put("bar", "barney"); m.put("baz", "wilma"); assertEquals("foo", m.order("", 1)); assertEquals("bar", m.order("foo", 1)); assertEquals("baz", m.order("bar", 1)); assertEquals("", m.order("baz", 1)); assertEquals("baz", m.order("", -1)); assertEquals("bar", m.order("baz", -1)); assertEquals("foo", m.order("bar", -1)); assertEquals("", m.order("foo", -1)); }