Collections list() method in Java with Examples
The list() method of java.util.Collections class is used to return an array list containing the elements returned by the specified enumeration in the order they are returned by the enumeration. This method provides interoperability between legacy APIs that return enumerations and new APIs that require collections.
public static ArrayList list(Enumeration e)
Parameters: This method takes enumeration e as a parameter providing elements for the returned array list.
Return Value: This method returns an array list containing the elements returned by the specified enumeration.
Below are the examples to illustrate the list() method
Current list :  Returned list: [A, B, C, D, E]
Current list :  Returned list: [10, 20, 30, 40, 50]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.