IntConsumer example

Description

IntConsumer represents an operation that accepts a single int-valued argument and returns no result. This is the primitive type specialization of Consumer for int.

Example

The following example shows how to use IntConsumer.


import java.util.function.IntConsumer;
/*ww  w  . j a v  a2s . c  o m*/
public class Main {

  public static void main(String[] args) {
    IntConsumer ic = (x)->System.out.println(x);
    
    ic.accept(3);

  }
}

The code above generates the following result.