1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.util.internal;
18
19 import java.util.Iterator;
20
21 public final class ReadOnlyIterator<T> implements Iterator<T> {
22 private final Iterator<? extends T> iterator;
23
24 public ReadOnlyIterator(Iterator<? extends T> iterator) {
25 if (iterator == null) {
26 throw new NullPointerException("iterator");
27 }
28 this.iterator = iterator;
29 }
30
31 @Override
32 public boolean hasNext() {
33 return iterator.hasNext();
34 }
35
36 @Override
37 public T next() {
38 return iterator.next();
39 }
40
41 @Override
42 public void remove() {
43 throw new UnsupportedOperationException("read-only");
44 }
45 }