co.unruly.control.Unit Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.karaf.jaas.command Show documentation
Show all versions of org.apache.karaf.jaas.command Show documentation
This bundle provides Karaf shell commands to manipulate JAAS security framework.
package co.unruly.control;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* Unit type, which contains only one possible value.
*
* This exists to offer a bridge between void and regular functions, providing
* convenience methods to convert between them.
*/
public enum Unit {
UNIT;
public static Function functify(Consumer toVoid) {
return x -> {
toVoid.accept(x);
return Unit.UNIT;
};
}
public static Consumer voidify(Function function) {
return function::apply;
}
public static Unit noOp(T __) {
return UNIT;
}
public static void noOpConsumer(T __) {
// do nothing
}
}
© 2015 - 2026 Weber Informatics LLC | Privacy Policy