### Question:
Sources { public static <T> Source<T> concat(List<? extends Source<? extends T>> sources) { Iterator<? extends Source<? extends T>> iter = sources.iterator(); return new Source<T>() { Source<? extends T> current; @Override public boolean next() throws IOException, InterruptedException { while (true) { if (current != null) { if (current.next()) { return true; } else { closeCurrent(); } } assert current == null; if (iter.hasNext()) { current = iter.next(); } else { return false; } } } @Override public T get() throws IOException, InterruptedException { if (current == null) { throw new NoSuchElementException(); } return current.get(); } @Override public void close() throws IOException { closeCurrent(); assert current == null; while (iter.hasNext()) { current = iter.next(); closeCurrent(); assert current == null; } } private void closeCurrent() throws IOException { if (current != null) { current.close(); current = null; } } }; } private  Sources(); static Source<T> empty(); @SafeVarargs static Source<T> wrap(T... values); static Source<T> wrap(Iterator<? extends T> iterator); static Source<T> concat(List<? extends Source<? extends T>> sources); static Source<T> merge(
            List<? extends Source<? extends T>> sortedSources,
            Comparator<? super T> comparator);  }### Answer:
@Test public void concat() throws Exception { List<Source<String>> sources = new ArrayList<>(); sources.add(Sources.wrap(iter("1", "2"))); sources.add(Sources.wrap(iter("3", "4"))); sources.add(Sources.wrap(iter("5", "6"))); List<String> objects = dump(Sources.concat(sources)); assertThat(objects, contains("1", "2", "3", "4", "5", "6")); }
@Test public void concat_empty() throws Exception { List<Source<String>> sources = new ArrayList<>(); List<String> objects = dump(Sources.concat(sources)); assertThat(objects, hasSize(0)); }