Supplier get example

Description

Supplier get method gets a result.

Syntax

get has the following syntax.


T get()

Example

The following example shows how to use get.


import java.util.function.Supplier;
/*w  w w .  j a  v a2 s . c  o 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.