![]() |
VOOZH | about |
The emptyEnumeration() method of Java Collections is used to get the empty enumeration that contains no elements in Java.
Syntax:
public static <T> Enumeration<T> emptyEnumeration()
Parameters: This method has no parameters.
Return Type: This method will return an empty enumeration.
Exceptions: This method will not arise any exceptions.
Example 1: Java program to check whether the enumeration has more elements or not. So we are using the hasMoreElements() method. This will return a boolean value. If the enumeration contains elements, it will return true, otherwise false.
Syntax:
object.hasMoreElements()
where object is an enumeration object
false
Example 2: In this example, we are going to get the next element of the empty enumeration using nextElement().
Syntax:
object.nextElement()
where object is an enumeration object
Empty