aQute.lib.promise.PromiseCollectors Maven / Gradle / Ivy
package aQute.lib.promise;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collector;
import org.osgi.util.promise.Promise;
import org.osgi.util.promise.PromiseFactory;
public class PromiseCollectors {
private PromiseCollectors() {}
public static Collector, List>, Promise>> toPromise(
PromiseFactory promiseFactory) {
return Collector.of(ArrayList::new, List::add, PromiseCollectors::combiner, promiseFactory::all);
}
private static > C combiner(C t, C u) {
t.addAll(u);
return t;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy