Skip to content

Commit 7a0cf54

Browse files
committed
Day-9 : Find distinct odd numbers in a given list.
1 parent 3e2bb6a commit 7a0cf54

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.java8;
2+
3+
import java.util.Arrays;
4+
import java.util.List;
5+
6+
public class DistinctOddNumbers {
7+
public static void main(String[] args) {
8+
List<Integer> integerList = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9, 9);
9+
List<Integer> distinctOddList = integerList.stream().filter(x -> x % 2 != 0).distinct().toList();
10+
System.out.println(distinctOddList);
11+
12+
13+
}
14+
}

0 commit comments

Comments
 (0)