@Test public void wrap_empty() throws Exception { List<String> objects = dump(Sources.wrap(SourcesTest.iter())); assertThat(objects, hasSize(0)); }
@SafeVarargs public static <T> Source<T> wrap(T... values) { return new Source<T>() { private int position = -1; @Override public boolean next() throws IOException, InterruptedException { if (position + 1 < values.length) { position++; return true; } else { return false; } } @Override public T get() throws IOException, InterruptedException { if (0 <= position && position < values.length) { return values[position]; } throw new NoSuchElementException(); } @Override public void close() { return; } }; }
Sources { @SafeVarargs public static <T> Source<T> wrap(T... values) { return new Source<T>() { private int position = -1; @Override public boolean next() throws IOException, InterruptedException { if (position + 1 < values.length) { position++; return true; } else { return false; } } @Override public T get() throws IOException, InterruptedException { if (0 <= position && position < values.length) { return values[position]; } throw new NoSuchElementException(); } @Override public void close() { return; } }; } }
Sources { @SafeVarargs public static <T> Source<T> wrap(T... values) { return new Source<T>() { private int position = -1; @Override public boolean next() throws IOException, InterruptedException { if (position + 1 < values.length) { position++; return true; } else { return false; } } @Override public T get() throws IOException, InterruptedException { if (0 <= position && position < values.length) { return values[position]; } throw new NoSuchElementException(); } @Override public void close() { return; } }; } private  Sources(); }
Sources { @SafeVarargs public static <T> Source<T> wrap(T... values) { return new Source<T>() { private int position = -1; @Override public boolean next() throws IOException, InterruptedException { if (position + 1 < values.length) { position++; return true; } else { return false; } } @Override public T get() throws IOException, InterruptedException { if (0 <= position && position < values.length) { return values[position]; } throw new NoSuchElementException(); } @Override public void close() { return; } }; } 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); }
Sources { @SafeVarargs public static <T> Source<T> wrap(T... values) { return new Source<T>() { private int position = -1; @Override public boolean next() throws IOException, InterruptedException { if (position + 1 < values.length) { position++; return true; } else { return false; } } @Override public T get() throws IOException, InterruptedException { if (0 <= position && position < values.length) { return values[position]; } throw new NoSuchElementException(); } @Override public void close() { return; } }; } 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);  }