Skip to content

Commit b8d031e

Browse files
committed
better java code
Signed-off-by: sBouzols <[email protected]>
1 parent 4135305 commit b8d031e

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/main/java/org/gridsuite/geodata/server/GeoDataService.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,7 @@ public List<LineGeoData> getLinesByIds(Network network, Set<String> linesIds) {
539539

540540
StopWatch stopWatch = StopWatch.createStarted();
541541

542-
List<Line> lines = new ArrayList<>();
543-
544-
linesIds.forEach(id -> {
545-
Line line = network.getLine(id);
546-
if (line != null) {
547-
lines.add(line);
548-
}
549-
});
542+
List<Line> lines = linesIds.stream().map(network::getLine).filter(Objects::nonNull).collect(Collectors.toList());
550543

551544
// read lines from DB
552545
Map<String, LineGeoData> linesGeoDataDb = lineRepository.findAllById(linesIds).stream().collect(Collectors.toMap(LineEntity::getId, this::toDto));

0 commit comments

Comments
 (0)