Update pom.xml, CompletableFutureUtils.java, and FloatPriorityQueue.java
This commit is contained in:
parent
37bbafdfbf
commit
0d566b88b0
2
pom.xml
2
pom.xml
@ -68,7 +68,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>17.0.0</version>
|
<version>19.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
|
@ -184,8 +184,8 @@ public class CompletableFutureUtils {
|
|||||||
public static <T> CompletableFuture<FloatPriorityQueue<T>> aggregatePq(Collection<CompletableFuture<FloatPriorityQueue<T>>> futureFloatPriorityQueues) {
|
public static <T> CompletableFuture<FloatPriorityQueue<T>> aggregatePq(Collection<CompletableFuture<FloatPriorityQueue<T>>> futureFloatPriorityQueues) {
|
||||||
final CompletableFuture<FloatPriorityQueue<T>> identityAggregatedResult = CompletableFuture.completedFuture(new FloatPriorityQueue<>());
|
final CompletableFuture<FloatPriorityQueue<T>> identityAggregatedResult = CompletableFuture.completedFuture(new FloatPriorityQueue<>());
|
||||||
|
|
||||||
return futureFloatPriorityQueues.parallelStream().reduce(identityAggregatedResult, (currentAggregatedResult, futureFloatPriorityQueue) -> {
|
return futureFloatPriorityQueues.stream().reduce(identityAggregatedResult, (currentAggregatedResult, futureFloatPriorityQueue) -> {
|
||||||
return currentAggregatedResult.thenApplyAsync((aggregatedFloatPriorityQueue) -> {
|
return currentAggregatedResult.thenApply((aggregatedFloatPriorityQueue) -> {
|
||||||
var futureFloatPriorityQueueValues = futureFloatPriorityQueue.join();
|
var futureFloatPriorityQueueValues = futureFloatPriorityQueue.join();
|
||||||
if (futureFloatPriorityQueueValues == aggregatedFloatPriorityQueue) {
|
if (futureFloatPriorityQueueValues == aggregatedFloatPriorityQueue) {
|
||||||
return aggregatedFloatPriorityQueue;
|
return aggregatedFloatPriorityQueue;
|
||||||
|
@ -224,7 +224,9 @@ public class FloatPriorityQueue<T> implements Queue<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean offer(ScoredValue<T> value) {
|
public boolean offer(ScoredValue<T> value) {
|
||||||
assert contentValues.size() == internalQueue.size();
|
int contentValuesSize = contentValues.size();
|
||||||
|
int internalQueueSize = internalQueue.size();
|
||||||
|
assert contentValuesSize == internalQueueSize;
|
||||||
|
|
||||||
boolean added = true;
|
boolean added = true;
|
||||||
float oldValue;
|
float oldValue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user