01: /*
02: * Copyright 2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.myfaces.shared_impl.util;
17:
18: import java.util.Iterator;
19: import java.util.NoSuchElementException;
20:
21: /**
22: * Iterator without elements
23: *
24: * @author Anton Koinov (latest modification by $Author: manolito $)
25: * @version $Revision: 380686 $ $Date: 2006-02-24 16:19:28 +0100 (Fr, 24 Feb 2006) $
26: */
27: public final class NullIterator implements Iterator {
28: //~ Static fields/initializers -----------------------------------------------------------------
29:
30: private static final NullIterator INSTANCE = new NullIterator();
31:
32: //~ Methods ------------------------------------------------------------------------------------
33:
34: public static final Iterator instance() {
35: return INSTANCE;
36: }
37:
38: public boolean hasNext() {
39: return false;
40: }
41:
42: public Object next() {
43: throw new NoSuchElementException();
44: }
45:
46: public void remove() {
47: throw new UnsupportedOperationException(this .getClass()
48: .getName()
49: + " UnsupportedOperationException");
50: }
51: }
|