Answers for "sum of list recursion java"

1

sum number in a list python using recursion

def listsum(numList):
   if len(numList) == 1:
        return numList[0]
   else:
        return numList[0] + listsum(numList[1:])

print(listsum([1,3,5,7,9]))
Posted by: Guest on August-03-2020
1

sum of arraylist java 8

int total = numbers.stream().mapToInt(i -> i.intValue()).sum();
		System.out.print(total);
Posted by: Guest on May-30-2020

Code answers related to "sum of list recursion java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language