Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Collection to List [duplicate]

I would like to ask: how do you convert a Collection to a List in Java?

like image 468
Mercer Avatar asked Mar 18 '10 15:03

Mercer


1 Answers

Collection<MyObjectType> myCollection = ...; List<MyObjectType> list = new ArrayList<MyObjectType>(myCollection); 

See the Collections trail in the Java tutorials.

like image 166
Michael Myers Avatar answered Sep 18 '22 19:09

Michael Myers