List<Rate> rateList =
guestList.stream()
.map(guest -> buildRate(ageRate, guestRate, guest))
.collect(Collectors.toList());
class Rate {
protected int index;
protected AgeRate ageRate;
protected GuestRate guestRate;
protected int age;
}
In the above code, is it possible to pass index of guestList
inside buildRate
method. I need to pass index also while building Rate
but could not manage to get index with Stream
.