Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to convert Iterator to mutable List in Java using `apache-commons`, `guava` or some other popular library

Is there any magicMethod working like this:

List<E> resultList = magicMethod((Iterator<E>)inputIterator);

NB: resultList should be mutable.

like image 636
Timofey Gorshkov Avatar asked Dec 20 '22 08:12

Timofey Gorshkov


1 Answers

You can use Lists#newArrayList(Iterator).

like image 62
miah Avatar answered Dec 29 '22 10:12

miah