AtomicReference<Integer> totalRd = new AtomicReference<>(0);
AtomicReference<Integer> totalRa = new AtomicReference<>(0);
AtomicReference<Integer> totalAst = new AtomicReference<>(0);
AtomicInteger index = new AtomicInteger(0);
gpsList.stream().forEach(gps -> {
index.getAndIncrement();
AtomicInteger index2 = new AtomicInteger(0);
traceLists.stream().anyMatch(trace -> {
index2.getAndIncrement();
if (index.get() == index2.get()){
trace.setASharpTurn(gps.getASharpTurn());
trace.setRapidDeceleration(gps.getRapidDeceleration());
trace.setRapidAcceleration(gps.getRapidAcceleration());
totalRd.updateAndGet(v -> v + gps.getRapidDeceleration());
totalRa.updateAndGet(v -> v + gps.getRapidAcceleration());
totalAst.updateAndGet(v -> v + gps.getASharpTurn());
}
return false;
});
});