Java Lambda - LongSupplier example

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


  1. LongSupplier getAsLong


The following example shows how to use LongSupplier.

import java.util.function.LongSupplier;
/*  w w  w .  j av  a 2  s .  co  m*/
public class Main {

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

The code above generates the following result.