CollectionSizedIterator implements SizedIterator<OBJECTT> { @Override public void remove() { this.iterator.remove(); --this.length; --this.index; } CollectionSizedIterator(Collection<OBJECTT> collection); @Pure @Override boolean hasNext(); @Override OBJECTT next(); @Override void remove(); @Pure @Override int index(); @Pure @Override int totalSize(); @Pure @Override int rest();  }
@Test public void remove() { assertSame(this.s1, this.iterator.next()); assertSame(this.s2, this.iterator.next()); this.iterator.remove(); assertSame(this.s3, this.iterator.next()); assertSame(this.s4, this.iterator.next()); this.iterator.remove(); assertSame(this.s5, this.iterator.next()); assertEquals(3, this.collection.size()); assertTrue(this.collection.contains(this.s1)); assertFalse(this.collection.contains(this.s2)); assertTrue(this.collection.contains(this.s3)); assertFalse(this.collection.contains(this.s4)); assertTrue(this.collection.contains(this.s5)); }