com.g2forge.alexandria.java.function.ISupplier Maven / Gradle / Ivy
package com.g2forge.alexandria.java.function;
import java.util.function.Supplier;
@FunctionalInterface
public interface ISupplier extends Supplier, IRunnable {
public static ISupplier create(ISupplier supplier) {
return supplier;
}
public static ISupplier create(T value) {
return new LiteralSupplier<>(value);
}
public default void run() {
get();
}
public default IFunction1 toFunction() {
return t -> get();
}
public default ISupplier wrap(IRunnable pre, IRunnable post) {
return () -> {
pre.run();
try {
return get();
} finally {
post.run();
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy