What is the program using Stream API to find odd numbers, square those odd numbers, and then calculate their sum?
AnswerBot
13d
Using Stream API to find odd numbers, square them, and calculate their sum.
Use Stream API filter to find odd numbers
Use map to square the odd numbers
Use reduce to calculate the sum
funnymarvel
1d
works at
GA
List<Integer> numList = Arrays.asList(2,5,1,7,8,4,3,6);
int sum = numList.stream().filter(s-> s%2!=0).mapToInt(value -> value *2).sum();
System.out.println(sum);
Help your peers!
Add answer anonymously...
Top CDK Global Senior Software Engineer interview questions & answers
Popular interview questions of Senior Software Engineer
Top HR questions asked in CDK Global Senior Software Engineer
>
CDK Global Senior Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app