@Test public void testRemove() { final List<String> list = new LinkedList<String>(); list.addAll(Arrays.asList("1", "2")); final LazyIterator<String> iterator = new LazyIterator<String>(list); assertEquals(iterator.next(), "1"); iterator.remove(); assertTrue(iterator.hasNext()); assertEquals(iterator.next(), "2"); iterator.remove(); assertFalse(iterator.hasNext()); assertTrue(list.isEmpty()); }
@Override public void remove() { ensureIterator(); iterator.remove(); }
LazyIterator implements Iterator<T> { @Override public void remove() { ensureIterator(); iterator.remove(); } }
LazyIterator implements Iterator<T> { @Override public void remove() { ensureIterator(); iterator.remove(); } LazyIterator(Iterable<? extends T> iterable); }
LazyIterator implements Iterator<T> { @Override public void remove() { ensureIterator(); iterator.remove(); } LazyIterator(Iterable<? extends T> iterable); @Override boolean hasNext(); @Override T next(); @Override void remove(); }
LazyIterator implements Iterator<T> { @Override public void remove() { ensureIterator(); iterator.remove(); } LazyIterator(Iterable<? extends T> iterable); @Override boolean hasNext(); @Override T next(); @Override void remove();  }