1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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 17package java.lang; 18 19import java.io.Serializable; 20import java.net.URL; 21import java.util.Enumeration; 22import java.util.NoSuchElementException; 23 24/** 25 * Empty enumeration class. Call getInstance() to get the singleton. 26 * 27 * This is not part of the Java spec, so must be package-scope only. 28 */ 29/*package*/ final class EmptyEnumeration implements Enumeration<URL>, Serializable { 30 31 private static final EmptyEnumeration mInst = new EmptyEnumeration(); 32 33 /** 34 * One instance per VM. 35 */ 36 private EmptyEnumeration() {} 37 38 /** 39 * Return instance. 40 */ 41 public static EmptyEnumeration getInstance() { 42 return mInst; 43 } 44 45 /** 46 * Enumeration implementation. 47 */ 48 public boolean hasMoreElements() { 49 return false; 50 } 51 52 public URL nextElement() { 53 throw new NoSuchElementException(); 54 } 55} 56 57