1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections.primitives.decorators;
18
19 import org.apache.commons.collections.primitives.ShortListIterator;
20
21
22
23
24
25
26
27
28 public final class UnmodifiableShortListIterator extends ProxyShortListIterator {
29 UnmodifiableShortListIterator(ShortListIterator iterator) {
30 this.proxied = iterator;
31 }
32
33 public void remove() {
34 throw new UnsupportedOperationException("This ShortListIterator is not modifiable.");
35 }
36
37 public void add(short value) {
38 throw new UnsupportedOperationException("This ShortListIterator is not modifiable.");
39 }
40
41 public void set(short value) {
42 throw new UnsupportedOperationException("This ShortListIterator is not modifiable.");
43 }
44
45 protected ShortListIterator getListIterator() {
46 return proxied;
47 }
48
49
50 public static final ShortListIterator wrap(ShortListIterator iterator) {
51 if(null == iterator) {
52 return null;
53 } else if(iterator instanceof UnmodifiableShortListIterator) {
54 return iterator;
55 } else {
56 return new UnmodifiableShortListIterator(iterator);
57 }
58 }
59
60 private ShortListIterator proxied = null;
61 }