Java Collection: what to convert Collection<List<String>> to ArrayList<List<String>> or List<List<String>>? -
i using multimap<string, list<string>>
in 1 of api's. values means list of list used .values()
method of multimap. method returning me collection<list<string>>
. play on index on collection want convert list<list<string>>
or arraylist<list<string>>
.
how cast or convert without building new arraylist , explicit add list values collections arraylist.
you can use appropriate constructor:
list<list<string>> yourlist = new arraylist<>(yourcollection);
the order of elements in list order of iterator of collection.
Comments
Post a Comment