
com.pivovarit.collectors.CompletionStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parallel-collectors Show documentation
Show all versions of parallel-collectors Show documentation
Parallel collection processing with customizable thread pools
package com.pivovarit.collectors;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
interface CompletionStrategy extends Function>, Stream> {
static CompletionStrategy unordered() {
return futures -> StreamSupport.stream(new CompletionOrderSpliterator<>(futures), false);
}
static CompletionStrategy ordered() {
return futures -> futures.stream().map(CompletableFuture::join);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy