0

I've got two lists:

List<String> names;
List<Integer> ages;

So, I would like to transform these lists in unique List of Person, Person class is like this:

public class Person {

 private String name;
 private Integer age;

}

How I do it using Guava or another way?

EN A
  • 39
  • 2
  • 7

1 Answers1

0

What you are looking for is the zip function which is the territory of functional languages. There is no such function in the Guava library, but you can find it in Functional Java.

Related questions:

Is there an accepted Java equivalent to Python's zip()?

Google Guava "zip" two lists

Community
  • 1
  • 1
Adam Arold
  • 29,285
  • 22
  • 112
  • 207