i would like to know if there is a more efficient way to sum all tree lists - summing their values at the same index.
The reason why i am asking its because, probably using Streams API, its possible to make it more generic, for any number of lists.
List<Double> listA = getListA();
List<Double> listB = getListB();
List<Double> listC = getListC();
int listsSize = listA.size();
List<?> collect = IntStream.range(0, listsSize)
.mapToObj(i -> listA.get(i) + listB.get(i) + list(C).get(i))
.collect(toList());
thanks for any insight.
Numbers?