Minisiia / LambdaStream

Create a list and fill 10 cells with random numbers, you need to output the sum of the squares of all elements of the list using map() and reduce().

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LambdaStream

Create a list and fill 10 cells with random numbers, you need to output the sum of the squares of all elements of the list using map() and reduce().

4. Java Advanced 9. Lambda expressions

Завдання 2

Створити список та заповнити рандомними числами 10 осередків, потрібно вивести суму квадратів усіх елементів списку. Ми використовуємо метод map() для зведення квадрат кожного елемента, а потім застосовуємо метод reduce() для згортки всіх елементів в одне число.

About

Create a list and fill 10 cells with random numbers, you need to output the sum of the squares of all elements of the list using map() and reduce().


Languages

Language:Java 100.0%