Close

Java 8 Functional Interfaces - BooleanSupplier.getAsBoolean() Examples

Java 8 Functional Interfaces Java Java API 


Interface:

java.util.function.BooleanSupplier

java.util.function.BooleanSupplierBooleanSupplierLogicBig

Method:

boolean getAsBoolean()

Returns a boolean.


Examples


package com.logicbig.example.booleansupplier;

import java.util.function.BooleanSupplier;

public class GetAsBooleanExample {


public static void main(String... args) {
BooleanSupplier bs = () -> Math.random() > 0.5;
System.out.println(bs.getAsBoolean());
}
}

Output

false




See Also