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