@ ReplacedBy ( "com.google.common.collect.Iterators#unmodifiableIterator()" ) public static < T > Iterator < T > getUnmodifiableIterator ( final Iterator < T > itr ) { return new Iterator < T > ( ) { public boolean hasNext ( ) { return itr . hasNext ( ) ; } public T next ( ) { return itr . next ( ) ; } public void remove ( ) { throw new UnsupportedOperationException ( "Cannot remove from an UnmodifiableIterator!" ) ; } } ; }
Get an iterator that returns the same elements as the supplied iterator but blocks removal .