Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3c3a68fd
authored
Apr 27, 2023
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.9.0 仲利车辆列表增加最后定位时间字段-- 优化空指针判断逻辑
1 parent
01b3cdc5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
src/test/java/cn/com/glsx/test/MainTest.java
src/test/java/cn/com/glsx/test/MainTest.java
View file @
3c3a68f
...
@@ -3,7 +3,10 @@ package cn.com.glsx.test;
...
@@ -3,7 +3,10 @@ package cn.com.glsx.test;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.function.Consumer
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -24,19 +27,14 @@ public class MainTest {
...
@@ -24,19 +27,14 @@ public class MainTest {
// Creating a list of Even Numbers
// Creating a list of Even Numbers
List
<
Integer
>
EvenNumbers
=
Arrays
.
asList
(
2
,
4
,
6
,
8
);
List
<
Integer
>
EvenNumbers
=
Arrays
.
asList
(
2
,
4
,
6
,
8
);
List
<
List
<
Integer
>>
listOfListofInts
=
List
<
List
<
Integer
>>
listOfListofInts
=
Arrays
.
asList
(
PrimeNumbers
,
OddNumbers
,
EvenNumbers
);
Arrays
.
asList
(
PrimeNumbers
,
OddNumbers
,
EvenNumbers
);
System
.
out
.
println
(
"The Structure before flattening is : "
+
System
.
out
.
println
(
"The Structure before flattening is : "
+
listOfListofInts
);
listOfListofInts
);
// Using flatMap for transformating and flattening.
// Using flatMap for transformating and flattening.
List
<
Integer
>
listofInts
=
listOfListofInts
.
stream
()
List
<
Integer
>
listofInts
=
listOfListofInts
.
stream
().
flatMap
(
Collection:
:
stream
).
collect
(
Collectors
.
toList
());
.
flatMap
(
list
->
list
.
stream
())
Optional
.
of
(
listofInts
).
ifPresent
(
System
.
out
::
println
);
.
collect
(
Collectors
.
toList
());
// System.out.println("The Structure after flattening is : " + listofInts);
System
.
out
.
println
(
"The Structure after flattening is : "
+
listofInts
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment