@Test public void testStreamAdapter() throws IOException { String expected = "[2,4,6]"; List<Integer> values = Arrays.asList(1, 2, 3); StringWriter writer = new StringWriter(); JSONEncoder jsonEncoder = new JSONEncoder(true); jsonEncoder.write(new StreamAdapter<>(values.stream().map(element -> element * 2)), writer); assertEquals(expected, writer.toString()); }
public StreamAdapter(Stream<T> stream) { this.stream = stream; }
StreamAdapter implements Iterable<T>, AutoCloseable { public StreamAdapter(Stream<T> stream) { this.stream = stream; } }
StreamAdapter implements Iterable<T>, AutoCloseable { public StreamAdapter(Stream<T> stream) { this.stream = stream; } StreamAdapter(Stream<T> stream); }
StreamAdapter implements Iterable<T>, AutoCloseable { public StreamAdapter(Stream<T> stream) { this.stream = stream; } StreamAdapter(Stream<T> stream); @Override Iterator<T> iterator(); @Override void close(); }
StreamAdapter implements Iterable<T>, AutoCloseable { public StreamAdapter(Stream<T> stream) { this.stream = stream; } StreamAdapter(Stream<T> stream); @Override Iterator<T> iterator(); @Override void close();  }