Functions are not first class citizens in Java, meaning that you cannot treat them as you would any regular data type such as a double. Java does however have a work-around using anonymous classes (or lambdas which are syntactic sugar) if you want to use a function as an argument to another function. See: What is a first class citizen function?

Answer from mkzh on Stack Overflow
🌐
DZone
dzone.com › coding › java › functional programming with java 8 functions
Functional Programming with Java 8 Functions
October 20, 2014 - So, as mentioned above, Java uses different functional interfaces for different function arities. And so Function<T,R> is a functional interface for any unary function where the domain and the codomain of the function may be of different types.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › function › Function.html
Function (Java Platform SE 8 )
3 weeks ago - java.util.function · Type Parameters: T - the type of the input to the function · R - the type of the result of the function · All Known Subinterfaces: UnaryOperator<T> Functional Interface: This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › function › package-summary.html
java.util.function (Java Platform SE 8 )
3 weeks ago - Functional interfaces provide target types for lambda expressions and method references. Each functional interface has a single abstract method, called the functional method for that functional interface, to which the lambda expression's parameter and return types are matched or adapted.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-functional-interfaces
Java Functional Interfaces - GeeksforGeeks
November 20, 2025 - The Java predicate functional interface can also be implemented using Lambda expressions. Predicate<Integer> predicate = (value) -> value != null; The function interface takes one argument and returns a result. It is commonly used for transforming data. Several variations exist: Bi-Function: Takes two arguments and returns a result. Unary Operator: Input and output are of the same type...
🌐
GeeksforGeeks
geeksforgeeks.org › java › function-interface-in-java
Function Interface in Java - GeeksforGeeks
July 11, 2025 - The Function Interface is a part of the java.util.function package that has been introduced since Java 8, to implement functional programming in Java. It represents a function that takes in one argument and produces a result. Hence, this functional interface takes in 2 generics, namely as follows: ... Note: The lambda expression assigned to an object of Function type is used to define its apply() which eventually applies the given function on the argument.
🌐
Mkyong
mkyong.com › home › java8 › java 8 function examples
Java 8 Function Examples - Mkyong.com
February 27, 2020 - In Java 8, Function is a functional interface; it takes an argument (object of type T) and returns an object (object of type R).
🌐
Baeldung
baeldung.com › home › java › core java › functional interfaces in java
Functional Interfaces in Java | Baeldung
March 26, 2025 - Note that Java 8’s default methods are not abstract and do not count; a functional interface may still have multiple default methods. We can observe this by looking at the Function’s documentation. The most simple and general case of a lambda is a functional interface with a method that receives one value and returns another. This function of a single argument is represented by the Function interface, which is parameterized by the types ...
Find elsewhere
🌐
Javabrahman
javabrahman.com › java-8 › java-8-java-util-function-function-tutorial-with-examples
Java 8 java.util.function.Function Tutorial with Examples
Common usage of Function is in ... another type. Since Function<T, R> is a functional interfaceClick to Read tutorial on Functional Interfaces, hence it can be used as the assignment target for a lambda expressionClick to Read Lambda Expressions Tutorial or a method referenceClick to Read Tutorial on Java 8's Method ...
🌐
Medium
medium.com › @nathjanmjay › mastering-functions-in-java-types-importance-and-practical-implementation-b9bef25c3667
Mastering Functions in Java: Types, Importance, and Practical Implementation | by Nath Janm jay | Medium
March 1, 2024 - Mastering Functions in Java: Types, Importance, and Practical Implementation What is a Function in Java? In Java, a function or method is a block of code that performs a specific task and can be …
🌐
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › util › function › Function.html
Function (Java SE 11 & JDK 11 )
January 20, 2026 - Package java.util.function · Type Parameters: T - the type of the input to the function · R - the type of the result of the function · All Known Subinterfaces: UnaryOperator<T> Functional Interface: This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › functional-interface-in-java
Functional Interface in Java : A Complete Guide
Supplier Functional Interface is the type which doesn't take in any arguments but returns a value. For example, you can use the Supplier to generate a random number or alphabet. Here's an example of a Supplier Functional Interface · import java.util.function.Supplier; public class ExampleSupplier { public static void main(String[] args) { Supplier
🌐
Readthedocs
java-8-tips.readthedocs.io › en › stable › funcinterfaces.html
4. Functional Interfaces — Java 8 tips 1.0 documentation
Functional interface provides target types for lambda expressions and method references. The java.util.function contains general purpose functional interfaces used by JDK and also available for end users like us. While they are not the complete set of funtional interfaces to which lambda ...
🌐
freeCodeCamp
freecodecamp.org › news › functional-programming-in-java
Functional Programming in Java
January 20, 2026 - The function interface provides a way to define and manipulate functions in Java code. The function interface represents a function that takes one input and produces one output. It has a single abstract method, apply(), which takes an argument of a specified type and returns a result of a specified type.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › FunctionalInterface.html
FunctionalInterface (Java Platform SE 8 )
3 weeks ago - Java™ Platform Standard Ed. 8 ... An informative annotation type used to indicate that an interface type declaration is intended to be a functional interface as defined by the Java Language Specification. Conceptually, a functional interface has exactly one abstract method.
🌐
Medium
medium.com › java-today › function-t-r-in-java-ca60c9f120e3
Function<T,R> in JAVA !. The Function family interfaces… | by Rohit Kumar | Java Today | Medium
September 14, 2024 - The Function family interfaces ... Stream API and functional programming. ... Description: Function<T, R> takes an input of type T and returns a result of type R....
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Get-the-most-from-Java-Function-interface-with-this-example
A simple Java Function interface example: Learn Functional programming fast
java.util.function.Function Java Interface Function<T,R> Parameter Types: T - the input given to the function R - the result running the function Popular Subinterface of Function: UnaryOperator<T>
🌐
ExamClouds
examclouds.com › home › java core › lambda in java language
Functional Interface Function - Java Core
Function<T, R> is a built-in functional interface included in Java SE 8 in the java.util.function package. The main purpose of this interface is mapping scenarios - when an object of one type is taken as input, and it is converted (or mapped) to another type.
🌐
Jenkov
jenkov.com › tutorials › java-functional-programming › functional-interfaces.html
Java Functional Interfaces
March 8, 2021 - Java functional interfaces are interfaces with a single abstract (unimplemented) method. This article explains the definition, and explains some of the built-in functional interfaces in Java.
🌐
Medium
medium.com › @nagarjun_nagesh › functional-interfaces-in-java-fe5ebf5bafed
Functional Interfaces in Java. In the previous article, we introduced… | by Nagarjun (Arjun) Nagesh | Medium
February 23, 2024 - Java provides a set of built-in ... categorized into four main types based on the operation they perform: Consumer, Supplier, Function, and Predicate....