diff --git a/pom.xml b/pom.xml index 27e6d4d..620e16e 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ org.jetbrains annotations - 17.0.0 + 19.0.0 com.google.guava diff --git a/src/main/java/org/warp/commonutils/concurrency/future/CompletableFutureUtils.java b/src/main/java/org/warp/commonutils/concurrency/future/CompletableFutureUtils.java index 9339e76..fc28d5f 100644 --- a/src/main/java/org/warp/commonutils/concurrency/future/CompletableFutureUtils.java +++ b/src/main/java/org/warp/commonutils/concurrency/future/CompletableFutureUtils.java @@ -184,8 +184,8 @@ public class CompletableFutureUtils { public static CompletableFuture> aggregatePq(Collection>> futureFloatPriorityQueues) { final CompletableFuture> identityAggregatedResult = CompletableFuture.completedFuture(new FloatPriorityQueue<>()); - return futureFloatPriorityQueues.parallelStream().reduce(identityAggregatedResult, (currentAggregatedResult, futureFloatPriorityQueue) -> { - return currentAggregatedResult.thenApplyAsync((aggregatedFloatPriorityQueue) -> { + return futureFloatPriorityQueues.stream().reduce(identityAggregatedResult, (currentAggregatedResult, futureFloatPriorityQueue) -> { + return currentAggregatedResult.thenApply((aggregatedFloatPriorityQueue) -> { var futureFloatPriorityQueueValues = futureFloatPriorityQueue.join(); if (futureFloatPriorityQueueValues == aggregatedFloatPriorityQueue) { return aggregatedFloatPriorityQueue; diff --git a/src/main/java/org/warp/commonutils/type/FloatPriorityQueue.java b/src/main/java/org/warp/commonutils/type/FloatPriorityQueue.java index 8fcdd38..fa8fab0 100644 --- a/src/main/java/org/warp/commonutils/type/FloatPriorityQueue.java +++ b/src/main/java/org/warp/commonutils/type/FloatPriorityQueue.java @@ -224,7 +224,9 @@ public class FloatPriorityQueue implements Queue { } public boolean offer(ScoredValue value) { - assert contentValues.size() == internalQueue.size(); + int contentValuesSize = contentValues.size(); + int internalQueueSize = internalQueue.size(); + assert contentValuesSize == internalQueueSize; boolean added = true; float oldValue;