@Test(expected = UnsupportedOperationException.class) public void testIteratorPreventsModification() { remove(); }
@Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator"); }
ReadOnlyIterator implements Iterator<T> { @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator"); } }
ReadOnlyIterator implements Iterator<T> { @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator"); } ReadOnlyIterator(Iterator<T> iterator); }
ReadOnlyIterator implements Iterator<T> { @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator"); } ReadOnlyIterator(Iterator<T> iterator); @Override boolean hasNext(); @Override T next(); @Override void remove(); }
ReadOnlyIterator implements Iterator<T> { @Override public void remove() { throw new UnsupportedOperationException("This is a read-only iterator"); } ReadOnlyIterator(Iterator<T> iterator); @Override boolean hasNext(); @Override T next(); @Override void remove();  }