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

io.datakernel.util.Initializer Maven / Gradle / Ivy

package io.datakernel.util;

import java.util.List;

import static java.util.Arrays.asList;

@FunctionalInterface
public interface Initializer> {
	void accept(T t);

	default Initializer andThen(Initializer next) {
		return t -> {
			this.accept(t);
			next.accept(t);
		};
	}

	static > Initializer empty() {
		return $ -> {};
	}

	static > Initializer combine(List> initializers) {
		return target -> initializers.forEach(initializer -> initializer.accept(target));
	}

	@SafeVarargs
	static > Initializer combine(Initializer... initializers) {
		return combine(asList(initializers));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy