1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections4.iterators;
18
19 import java.util.NoSuchElementException;
20
21
22
23
24
25
26 abstract class AbstractEmptyIterator<E> {
27
28
29
30
31 protected AbstractEmptyIterator() {
32 }
33
34 public void add(final E obj) {
35 throw new UnsupportedOperationException("add() not supported for empty Iterator");
36 }
37
38 public boolean hasNext() {
39 return false;
40 }
41
42 public boolean hasPrevious() {
43 return false;
44 }
45
46 public E next() {
47 throw new NoSuchElementException("Iterator contains no elements");
48 }
49
50 public int nextIndex() {
51 return 0;
52 }
53
54 public E previous() {
55 throw new NoSuchElementException("Iterator contains no elements");
56 }
57
58 public int previousIndex() {
59 return -1;
60 }
61
62 public void remove() {
63 throw new IllegalStateException("Iterator contains no elements");
64 }
65
66 public void reset() {
67
68 }
69
70 public void set(final E obj) {
71 throw new IllegalStateException("Iterator contains no elements");
72 }
73
74 }