Java 8 | ObjIntConsumer Interface with Example Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The ObjIntConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments and produces a result. However these kind of functions don't return any value. Hence this functional interface takes in one generic namely:- T: denotes the type of the input argument to the operation The lambda expression assigned to an object of ObjIntConsumer type is used to define its accept() which eventually applies the given operation on its argument. It takes in a int-valued and a T-valued argument and is expected to operate without any side effects. It is more like using an object of type BiConsumer<T, Int> except the fact that one is a reference and one is a primitive data type in this case. Hence we will be obtaining one reference and one value when this function is called. Functions in ObjIntConsumer Interface The ObjIntConsumer interface consists of the following two functions: 1. accept() This method accepts two values and performs the operation on the given arguments. Syntax: void accept(T t, int value) Parameters: This method takes in two parameters: t- the first input argument value- the second input argument Return Value: This method does not return any value. Below is the code to illustrate accept() method: Program: Java // Java code to demonstrate // accept() method of ObjIntConsumer Interface import java.util.Arrays; import java.util.List; import java.util.function.ObjIntConsumer; import java.util.stream.Stream; public class GFG { public static void main(String args[]) { // Get the list from which // the Interface is to be instantiated. List<Integer> arr = Arrays.asList(3, 2, 5, 7, 4); // Instantiate the ObjIntConsumer interface ObjIntConsumer<List<Integer> > func = (list, num) -> { list.stream() .forEach( a -> System.out.println(a * num)); }; func.accept(arr, 2); } } Output: 6 4 10 14 8 Comment More infoAdvertise with us Next Article Java 8 | ObjDoubleConsumer Interface with Example P psil123 Follow Improve Article Tags : Misc Java Java - util package java-basics Java 8 Java-Functional Programming +2 More Practice Tags : JavaMisc Similar Reads Java 8 | ObjLongConsumer Interface with Example The ObjLongConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments and produces a result. However these kind of functions don't return any value. Hence th 2 min read Java 8 | ObjLongConsumer Interface with Example The ObjLongConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments and produces a result. However these kind of functions don't return any value. Hence th 2 min read Java 8 | ObjDoubleConsumer Interface with Example The ObjDoubleConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments and produces a result. However these kind of functions don't return any value. Hence 2 min read Java 8 | ObjDoubleConsumer Interface with Example The ObjDoubleConsumer Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in two arguments and produces a result. However these kind of functions don't return any value. Hence 2 min read Java Native Interface with Example In the Programming World, it is often seen in the comparison of Java vs C/C++. Although the comparison doesn't make any such sense, as both the languages have their Pros and Cons, but what if we can use multiple languages in a single Program?In this article, we will learn How to use JNI(Java Native 4 min read ToIntFunction Interface in Java with Examples The ToIntFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in an argument of type T and produces an int-valued result. This functional interface takes in only one ge 1 min read Like