How to use java8 stream to add the same subscript values in two List < Integer > collections to generate a new List

List<Integer> list1 =Arrays.asList(1,2,3,4,5);
List<Integer> list2 =Arrays.asList(1,2,3,4,5);

as above, for two list objects, how to use the function provided by java8 stream to add the same subscript values in the two list to generate a new list
if the above two list should generate the result should be
{2Jing 4pm 8JJ 10}

Mar.13,2021

List<Integer> list1 =Arrays.asList(1,2,3,4,5);
List<Integer> list2 =Arrays.asList(1,2,3,4,5);

List<Integer> result = IntStream.range(0, list1.size())
                                .map(i -> list1.get(i) + list2.get(i))
                                .boxed()
                                .collect(Collectors.toList());
Menu