BooleanSupplier represents a supplier of boolean-valued results.
The following example shows how to use BooleanSupplier
.
import java.util.function.BooleanSupplier; // ww w .ja v a 2s . 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.