You could do:
List<Person> res = IntStream.range(0, firstName.size())
.mapToObj(i -> new Person(firstName.get(i), lastName.get(i)))
.collect(Collectors.toList());
However this is assuming both List
‘s are the same size
This solution uses IntStream::range
to generate a Stream of indices for the two List
‘s