I\'m working with a 3d party library, and they return Collections that lack type specifications (e.g. public List getFoo();) , and I\'m trying to convert their
public List getFoo();
Collectors.toList() returns a List, not an ArrayList. This will compile:
public static void main(String[] args) { ArrayList> l = getRawArrayList(); List l2 = l.stream().map(Object::toString).collect(Collectors.toList()); }