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

io.polaris.core.function.Visitable Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.function;

import java.util.Iterator;
import java.util.function.Consumer;
import java.util.stream.Stream;

/**
 * @author Qt
 * @since  Sep 06, 2023
 */
@FunctionalInterface
public interface Visitable {

	void visit(Consumer visitor);

	static  Visitable of(Iterable iterable) {
		return iterable::forEach;
	}

	static  Visitable of(Iterator iterator) {
		return iterator::forEachRemaining;
	}

	static  Visitable of(Stream stream) {
		return stream::forEach;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy