Java Lambda - ObjIntConsumer accept example








ObjIntConsumer accept performs this operation on the given arguments.

Syntax

accept has the following syntax.

void accept(T t, int value)

Example

The following example shows how to use accept.

import java.util.function.ObjIntConsumer;
/*w w w . j  ava 2s.  c  om*/
public class Main {

  public static void main(String[] args) {
    ObjIntConsumer<String> i  = (s,d)->System.out.println(s+d);
    
   
    i.accept("java2s.com ",234);
  }
}

The code above generates the following result.