Supplier example

Description

Supplier represents a supplier of results.

Example

The following example shows how to use Supplier.


import java.util.function.Supplier;
/*from  w w w.  j a  v  a2  s.  co m*/
public class Main {

  public static void main(String[] args) {
    Supplier<String> i  = ()-> "java2s.com";
    
    System.out.println(i.get());
  }
}

The code above generates the following result.