Class SupplierExample

java.lang.Object
modernfeatures.lambda.builtinfunctionsdemo.SupplierExample

public class SupplierExample extends Object
Demonstrates the use of the built-in functional interface Supplier<T>.

  • Supplier<T> represents a supplier of results.
  • No input argument; returns a value of type T.
  • Key method to implement: get().

Example usage:

   Supplier<String> s = () -> "Hello";
   System.out.println(s.get());
 
  • Constructor Details

    • SupplierExample

      public SupplierExample()
  • Method Details

    • main

      public static void main(String[] args)