FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-programming/javaUpdates/src/stream/MapFunctionn.java at master · 9146887137/java-programming · GitHub
9146887137
/
java-programming
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-programming
/
javaUpdates
/
src
/
stream
/
MapFunctionn.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (19 loc) · 807 Bytes
Breadcrumbs
java-programming
/
javaUpdates
/
src
/
stream
/
MapFunctionn.java
Copy path
File metadata and controls
27 lines (19 loc) · 807 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package
stream
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
List
;
import
java
.
util
.
Optional
;
import
java
.
util
.
stream
.
Collectors
;
public
class
MapFunctionn
{
public
static
void
main
(
String
[]
args
) {
List
<
Integer
>
l
=
Arrays
.
asList
(
56
,
3
,
98
,
42
,
9
,
2
,
89
,
5
,
45
,
9
,
0
,
5
,
9
);
List
<
Integer
>
list1
=
l
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
//find unique element from stream
System
.
out
.
println
(
list1
);
List
<
Integer
>
list2
=
l
.
stream
().
dropWhile
(
num
->
num
%
2
==
0
).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
list2
);
List
<
Integer
>
list3
=
l
.
stream
().
filter
(
num
->
num
>=
70
).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
list3
);
Optional
<
Integer
>
max
=
l
.
stream
().
max
((
n1
,
n2
)->
n1
>
n2
?
1
:
n1
<
n2
?-
1
:
0
);
System
.
out
.
println
(
max
.
get
());
}
}
Back
|
FazBrowse Home
|
New Git URL