From the course: Functional Programming with Java
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Returning functions - Java Tutorial
From the course: Functional Programming with Java
Returning functions
- [Instructor] So far we've seen that it's possible to define functions in pretty much the same way we define any other kind of object, and we've also seen that it's possible to pass functions as arguments, again, similar to other types. So the next logical thing for us to look at with respect to first class functions in Java is our ability to return functions from other functions. Now, the usefulness of first class functions has been kind of limited up until now without this final piece of our first class functions puzzle. This is the place where the flexibility that first class functions give us really starts to shine through. So first let's try and wrap our heads around the concept of functions that return functions. In programming, it's common to hear functions referred to as a black box. You put data in the box and you get some different data out. So if we're talking about a function called double for example, you put one number into the box, say five, and then we get another…
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.