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 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 final <T extends Object> Iterator<T> instance() {
22 return instance;
23 }
24
25 private EmptyIterator() {}
26
27 public boolean hasNext() { return false; }
28
29 public T next() { return null; }
30
31 public void remove() {
32 throw new UnsupportedOperationException();
33 }
34 }