FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java8Examples/Java8Examples/src/streams/MapEx.java at master · suatoz/java8Examples · GitHub
suatoz
/
java8Examples
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
java8Examples
/
Java8Examples
/
src
/
streams
/
MapEx.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (25 loc) · 1.08 KB
Breadcrumbs
java8Examples
/
Java8Examples
/
src
/
streams
/
MapEx.java
Copy path
File metadata and controls
32 lines (25 loc) · 1.08 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
package
streams
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
List
;
import
java
.
util
.
stream
.
Collectors
;
import
dataclasses
.
Staff
;
public
class
MapEx
{
public
static
void
main
(
String
[]
args
) {
List
<
String
>
alpha
=
Arrays
.
asList
(
"a"
,
"b"
,
"c"
,
"d"
);
List
<
Integer
>
beta
=
Arrays
.
asList
(
1
,
2
,
3
,
4
,
5
);
toUpperCaseLambda
(
alpha
,
beta
);
System
.
out
.
println
(
"-------------------Staff------------------"
);
mapExForClassType
(
Staff
.
getStaffs
());
}
private
static
void
toUpperCaseLambda
(
List
<
String
>
alpha
,
List
<
Integer
>
beta
) {
List
<
String
>
collect
=
alpha
.
stream
().
map
(
String
::
toUpperCase
).
collect
(
Collectors
.
toList
());
collect
.
forEach
(
System
.
out
::
println
);
System
.
out
.
println
(
"-------------------Extra------------------"
);
List
<
Integer
>
integerMap
=
beta
.
stream
().
map
(
n
->
n
*
2
).
collect
(
Collectors
.
toList
());
integerMap
.
forEach
(
System
.
out
::
println
);
}
private
static
void
mapExForClassType
(
List
<
Staff
>
staffList
) {
List
<
String
>
getNames
=
staffList
.
stream
().
map
(
m
->
m
.
getName
()).
collect
(
Collectors
.
toList
());
getNames
.
forEach
(
System
.
out
::
println
);
}
}
Back
|
FazBrowse Home
|
New Git URL