@Test
    public void shouldIterateToSet() {
        final List<Integer> list = Arrays.asList(1, 2, 3, 3, 2, 1);
        final Iterator<Integer> itty = list.iterator();
        final Set<Integer> set = IteratorUtils.set(itty);
        assertEquals(3, set.size());
        assertThat(set, is(new HashSet<>(list)));
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java