BooleanSupplier example
Description
BooleanSupplier represents a supplier of boolean-valued results.
Example
The following example shows how to use BooleanSupplier
.
import java.util.function.BooleanSupplier;
/*w w w. j a v a 2 s. c o m*/
public class Main {
public static void main(String[] args) {
BooleanSupplier bs = () -> true;
System.out.println(bs.getAsBoolean());
int x = 0, y= 1;
bs = () -> x > y;
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 »