1 17 package org.apache.commons.collections.primitives.decorators; 18 19 import org.apache.commons.collections.primitives.IntIterator; 20 21 28 public final class UnmodifiableIntIterator extends ProxyIntIterator { 29 UnmodifiableIntIterator(IntIterator iterator) { 30 this.proxied = iterator; 31 } 32 33 public void remove() { 34 throw new UnsupportedOperationException ("This IntIterator is not modifiable."); 35 } 36 37 protected IntIterator getIterator() { 38 return proxied; 39 } 40 41 42 public static final IntIterator wrap(IntIterator iterator) { 43 if(null == iterator) { 44 return null; 45 } else if(iterator instanceof UnmodifiableIntIterator) { 46 return iterator; 47 } else { 48 return new UnmodifiableIntIterator(iterator); 49 } 50 } 51 52 private IntIterator proxied = null; 53 } 54 | Popular Tags |