Use stream

This commit is contained in:
Volodymyr Babak 2021-05-18 11:09:52 +03:00
parent bb064cbbbd
commit c081f9b8d3

View File

@ -133,6 +133,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@Slf4j
@Data
@ -430,14 +431,10 @@ public final class EdgeGrpcSession implements Closeable {
}
private List<DownlinkMsg> convertToDownlinkMsgsPack(List<EdgeEvent> edgeEvents) {
List<DownlinkMsg> result = new ArrayList<>();
for (EdgeEvent edgeEvent : edgeEvents) {
DownlinkMsg downlinkMsg = convertToDownlinkMsg(edgeEvent);
if (downlinkMsg != null) {
result.add(downlinkMsg);
}
}
return result;
return edgeEvents
.stream()
.map(this::convertToDownlinkMsg)
.collect(Collectors.toList());
}
private DownlinkMsg processEntityMergeRequestMessage(EdgeEvent edgeEvent) {