IntSupplier example

Description

IntSupplier represents a supplier of int-valued results. This is the int-producing primitive specialization of Supplier.

Example

The following example shows how to use IntSupplier.


import java.util.function.IntSupplier;
/*  w  w w  .j  a  v  a 2 s .c  o m*/
public class Main {

  public static void main(String[] args) {
    IntSupplier i = ()-> Integer.MAX_VALUE;
    
    System.out.println(i.getAsInt());

  }
}

The code above generates the following result.