All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.lib.promise.PromiseCollectors Maven / Gradle / Ivy

There is a newer version: 7.1.0
Show newest version
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