@Test
    public void shouldConvertIteratorToListAndSort() {
        final Iterator<Integer> itty = Arrays.asList(1, 2, 3).iterator();
        final List<Integer> list = IteratorUtils.list(itty, Comparator.<Integer>reverseOrder());
        assertEquals(3, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(1, list.get(2).intValue());
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java