KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > utils > EmptyEnumeration


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.utils;
12
13 import java.util.Enumeration JavaDoc;
14
15 /**
16  * An enumeration that never has any elements.
17  */

18 public class EmptyEnumeration implements Enumeration JavaDoc {
19     /**
20      * Singleton instance
21      */

22     protected static Enumeration JavaDoc instance = new EmptyEnumeration();
23
24     /**
25      * EmptyEnumeration constructor comment.
26      */

27     public EmptyEnumeration() {
28         super();
29     }
30
31     /**
32      * Returns the singleton instance
33      */

34     public static Enumeration JavaDoc getEnumeration() {
35         return instance;
36     }
37
38     /**
39      * Returns true if this enumeration has more elements.
40      */

41     public boolean hasMoreElements() {
42         return false;
43     }
44
45     /**
46      * @see Enumeration#nextElement()
47      */

48     public Object JavaDoc nextElement() {
49         throw new java.util.NoSuchElementException JavaDoc(Messages.utils_noElements);
50     }
51 }
52
Popular Tags