Last active
September 8, 2020 08:02
-
-
Save lukaseder/d713cce142c5475c00dba959f1bc58e0 to your computer and use it in GitHub Desktop.
SimplifyThis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<MappedTable> mappedTables1() { | |
if (mappedTables == null) { | |
mappedTables = T_BOOK | |
.getSchema() | |
.getTables() | |
.stream() | |
.map(t -> { | |
Table<?> l = lookupTable(t.getName()); | |
return l == null ? null : new MappedTable().withInput(t.getName()).withOutput(l.getName()); | |
}) | |
.filter(Predicate.not(Objects::isNull)) | |
.collect(Collectors.toList()); | |
} | |
return mappedTables; | |
} | |
List<MappedTable> mappedTables2() { | |
if (mappedTables == null) { | |
mappedTables = T_BOOK | |
.getSchema() | |
.getTables() | |
.stream() | |
.flatMap(t -> | |
Optional.ofNullable(lookupTable(t.getName())) | |
.map(l -> new MappedTable().withInput(t.getName()).withOutput(l.getName())) | |
.stream() | |
) | |
.filter(Predicate.not(Objects::isNull)) | |
.collect(Collectors.toList()); | |
} | |
return mappedTables; | |
} |
Mordavolt
commented
Sep 8, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment