FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-programming/javaUpdates/src/stream/StreamApi.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
/
StreamApi.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (24 loc) · 1.21 KB
Breadcrumbs
java-programming
/
javaUpdates
/
src
/
stream
/
StreamApi.java
Copy path
File metadata and controls
36 lines (24 loc) · 1.21 KB
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
28
29
30
31
32
33
34
35
36
package
stream
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
Collection
;
import
java
.
util
.
Iterator
;
import
java
.
util
.
List
;
import
java
.
util
.
function
.
Function
;
import
java
.
util
.
function
.
Predicate
;
import
java
.
util
.
stream
.
Collectors
;
public
class
StreamApi
{
public
static
void
main
(
String
[]
args
) {
List
<
Integer
>
i
=
Arrays
.
asList
(
48
,
67
,
89
,
90
,
34
,
23
,
545
,
78
,
90
,
23
);
System
.
out
.
println
(
i
);
List
<
Integer
>
evenlist
=
i
.
parallelStream
().
dropWhile
((
ele
)->
ele
%
2
==
0
).
toList
();
//dropwhile method is method of stream which is used to drop the the element from given stream according to predicate
System
.
out
.
println
(
evenlist
);
List
<
Integer
>
map
=
evenlist
.
stream
().
map
((
ele
)->
ele
+
1
).
toList
();
//map is the method of stream which is used to apply the some functionality to method
System
.
out
.
println
(
map
);
System
.
out
.
println
(
map
.
stream
().
anyMatch
((
ele
)->
ele
==
24
)?
"element present"
:
"element not present"
);
//anymatch is method of stream class which is return boolean value according to predicate
System
.
out
.
println
(
i
.
stream
().
findAny
().
get
());
//this is used to find anny element randomly
System
.
out
.
println
(
i
.
stream
().
findAny
().
get
());
//this is used to find anny element randomly
}
}
Back
|
FazBrowse Home
|
New Git URL