@Override public void close() { if (closed.compareAndSet(false,true)) { stream().close(); } }
private List<ELEMENT> initList() { if (list == null) { list = Lists.newArrayList(stream.iterator()); stream.close(); } return list; }
private List<ELEMENT> initList() { if (list == null) { list = Lists.newArrayList(stream.iterator()); stream.close(); } return list; }
@Override public void close() { stream.close(); } }
@Override public void close() { stream.close(); } }
@Override public final void close() { if (!closed) { stream.close(); Stream.of(resources).forEach(r -> { try { r.close(); } catch (final Exception e) { LOG.warn(e.getMessage(), e); } }); closed = true; } }
@Override public void close() { if (closed.compareAndSet(false,true)) { stream().close(); } }
lines.close(); System.out.println(readCases);
list.forEach(action); } finally { list.close();