java stream to list

Java
List<String> temp = toCheck.stream().map((a -> a.getFoo())).collect(Collectors.toList());
Source

Also in Java: