1
2
3
4 package net.sourceforge.pmd.util;
5
6 import java.util.Iterator;
7
8
9
10
11
12
13
14
15 public final class EmptyIterator<T extends Object> implements Iterator<T> {
16
17 @SuppressWarnings("rawtypes")
18 public static final Iterator INSTANCE = new EmptyIterator();
19
20 @SuppressWarnings("unchecked")
21 public static <T extends Object> Iterator<T> instance() {
22 return INSTANCE;
23 }
24
25 private EmptyIterator() {
26 }
27
28 public boolean hasNext() {
29 return false;
30 }
31
32 public T next() {
33 return null;
34 }
35
36 public void remove() {
37 throw new UnsupportedOperationException();
38 }
39 }