Skip to content

Commit 3e2bb6a

Browse files
committed
Day-9 : Convert a list of integers to a list of their squares.
1 parent b72b49f commit 3e2bb6a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.java8;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
7+
public class ConvertToSquare {
8+
public static void main(String[] args) {
9+
List<Integer> integerList = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9);
10+
List<Integer> resultList = integerList.stream().map(x -> x * x).toList();
11+
}
12+
}

0 commit comments

Comments
 (0)