@Test public void testBug3094() throws IOException { List<String> empty = Collections.emptyList(); try (IteratorReader instance = new IteratorReader(empty)) { assertNotNull(instance); assertEquals(-1, instance.read()); } }
@Override public int read(char[] cbuf, int off, int len) throws IOException { if (current != null) { int ret = current.read(cbuf, off, len); if (ret > 0 || len == 0) { return ret; } } if (iterator.hasNext()) { current = new StringReader(iterator.next() + '\n'); return current.read(cbuf, off, len); } else { return -1; } }
IteratorReader extends Reader { @Override public int read(char[] cbuf, int off, int len) throws IOException { if (current != null) { int ret = current.read(cbuf, off, len); if (ret > 0 || len == 0) { return ret; } } if (iterator.hasNext()) { current = new StringReader(iterator.next() + '\n'); return current.read(cbuf, off, len); } else { return -1; } } }
IteratorReader extends Reader { @Override public int read(char[] cbuf, int off, int len) throws IOException { if (current != null) { int ret = current.read(cbuf, off, len); if (ret > 0 || len == 0) { return ret; } } if (iterator.hasNext()) { current = new StringReader(iterator.next() + '\n'); return current.read(cbuf, off, len); } else { return -1; } } IteratorReader(Iterable<String> iterable);  IteratorReader(Iterator<String> iterator); }
IteratorReader extends Reader { @Override public int read(char[] cbuf, int off, int len) throws IOException { if (current != null) { int ret = current.read(cbuf, off, len); if (ret > 0 || len == 0) { return ret; } } if (iterator.hasNext()) { current = new StringReader(iterator.next() + '\n'); return current.read(cbuf, off, len); } else { return -1; } } IteratorReader(Iterable<String> iterable);  IteratorReader(Iterator<String> iterator); @Override int read(char[] cbuf, int off, int len); @Override void close(); }
IteratorReader extends Reader { @Override public int read(char[] cbuf, int off, int len) throws IOException { if (current != null) { int ret = current.read(cbuf, off, len); if (ret > 0 || len == 0) { return ret; } } if (iterator.hasNext()) { current = new StringReader(iterator.next() + '\n'); return current.read(cbuf, off, len); } else { return -1; } } IteratorReader(Iterable<String> iterable);  IteratorReader(Iterator<String> iterator); @Override int read(char[] cbuf, int off, int len); @Override void close();  }