From the course: Functional Programming with Java
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
First-class functions - Java Tutorial
From the course: Functional Programming with Java
First-class functions
- [Instructor] The third and final major concept of functional programming is something called first-class functions. This is where things really start to get interesting in functional programming and where the power and flexibility of functional programming really start to shine through. So what exactly do we mean when we talk about first-class functions? Well, in object-oriented programming, we generally treat data and functions as entirely different types of entities. We would probably never think of, for example, creating an array of functions or passing functions as arguments to other functions, or even stranger, returning functions from other functions. However, with functional programming, it's not only possible to do these things, it's in fact a source of tremendous flexibility. In Java, first-class functions are done using the function interface, which allows us to work with functions in a very similar way to how we normally treat other objects or values. And we'll see…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.