Given Iterator<Element>, how can we conveniently convert that Iterator to a List<Element>, so that we can use List‘s operations on it such as get(index), add(element), etc.
Given Iterator<Element> , how can we conveniently convert that Iterator to a List<Element> ,
Share
Better use a library like Guava:
Another Guava example:
or Apache Commons Collections: