Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java 8 function supplier consumer

@Testpublic void supplierWithOptional(){    
  Supplier<Double> doubleSupplier = () -> Math.random();   
  Optional<Double> optionalDouble = Optional.empty();    
  System.out.println(optionalDouble.orElseGet(doubleSupplier));}
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #java #function #supplier #consumer
ADD COMMENT
Topic
Name
8+8 =