![]() |
VOOZH | about |
The enumeration() method of java.util.Collections class is used to return an enumeration over the specified collection. This provides interoperability with legacy APIs that require an enumeration as input.
Syntax:
public static Enumeration enumeration(Collection c)
Parameters: This method takes the collection c as a parameter for which an enumeration is to be returned.
Return Value: This method returns an enumeration over the specified collection.
Below are the examples to illustrate the enumeration() method
Example 1:
List: [Ram, Gopal, Verma] Enumeration over list: Value is: Ram Value is: Gopal Value is: Verma
Example 2:
List: [20, 30, 40] Enumeration over list: Value is: 20 Value is: 30 Value is: 40