Google Guava “zip” two lists

As of Guava 21, this is possible via Streams.zip():

List<Person> persons = Streams.zip(names.stream(), ages.stream(), Person::new)
                              .collect(Collectors.toList());

Leave a Comment