LongSupplier example

Description

LongSupplier represents a supplier of long-valued results. This is the long-producing primitive specialization of Supplier.

Example

The following example shows how to use LongSupplier.


import java.util.function.LongSupplier;
//from  w  ww .  j a  va 2s  . c  o  m
public class Main {

  public static void main(String[] args) {
    LongSupplier i = () -> Long.MAX_VALUE;
    
    System.out.println(i.getAsLong());
  }
}

The code above generates the following result.