KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > util > EmptyEnumeration


1 // vi: set ts=3 sw=3:
2
package org.apache.slide.util;
3
4 import java.util.Enumeration JavaDoc;
5 import java.util.NoSuchElementException JavaDoc;
6
7
8 /**
9  * Implementaion of empty {@link java.util.Enumeration}.
10  *
11  * <p>Does this exist in Comons Collections?
12  */

13 public class EmptyEnumeration implements Enumeration JavaDoc
14 {
15
16     public static Enumeration JavaDoc INSTANCE = new EmptyEnumeration();
17     
18     private EmptyEnumeration() {}
19     
20     public boolean hasMoreElements()
21     {
22         return false;
23     }
24
25     public Object JavaDoc nextElement()
26     {
27         throw new NoSuchElementException JavaDoc();
28     }
29
30 }
31
Popular Tags