@Test
    public void shouldFlatMapIterator() {
        final List<Iterator<Integer>> firstList = Arrays.asList(Arrays.asList(1, 2, 3).iterator(), new ArrayList<Integer>().iterator(), Arrays.asList(4, 5, 6).iterator());
        final Iterator<Iterator<Integer>> itty = firstList.iterator();
        final List<Integer> list = IteratorUtils.list(IteratorUtils.flatMap(itty, x -> IteratorUtils.map(x, i -> i * 10)));
        assertEquals(6, list.size());
        assertThat(list, is(Arrays.asList(10, 20, 30, 40, 50, 60)));
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java