BooleanSupplier getAsBoolean example
Description
BooleanSupplier getAsBoolean gets a result as boolean type from the functional interface.
Syntax
getAsBoolean
has the following syntax.
boolean getAsBoolean()
Example
The following example shows how to use getAsBoolean
.
import java.util.function.BooleanSupplier;
// w ww . ja v a2s. com
public class Main {
public static void main(String[] args) {
BooleanSupplier bs = () -> true;
System.out.println(bs.getAsBoolean());
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »