@Test public void set_by_sorted() { Map<Integer, Group> results = BASIC_RESULTS_UNORDERED .transform(groupBy(postId).as(postName, sortedSet(commentId))); Group group = results.get(1); Iterator<Integer> it = group.getSet(commentId).iterator(); assertEquals(1, it.next().intValue()); assertEquals(2, it.next().intValue()); assertEquals(3, it.next().intValue()); }
@Test public void set_by_sorted_reverse() { Map<Integer, Group> results = BASIC_RESULTS_UNORDERED .transform(groupBy(postId).as(postName, sortedSet(commentId, Ordering.natural().reverse()))); Group group = results.get(1); Iterator<Integer> it = group.getSet(commentId).iterator(); assertEquals(3, it.next().intValue()); assertEquals(2, it.next().intValue()); assertEquals(1, it.next().intValue()); }