Java Collections list() MethodThe list() method of Java Collections class is used to get an array list containing the elements returned by the specified enumeration in the order in which they are returned by the enumeration. SyntaxFollowing is the declaration of list() method: Parameter
ReturnsThe list() method returns an array list containing the elements returned by the specified enumeration. ExceptionsNA Compatibility VersionJava 1.4 and above Example 1Test it NowOutput: Value of returned list: [A, B, C, D, E] Example 2Test it NowOutput: Value of returned list: [1, 2, 3, 4, 5] Example 3Test it NowOutput: List elements: [Java, PHP, Array, String, C++] Next TopicJava Collections Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India