The third implication of first-class functions is that you can return functions from other functions. Learn what this looks like in Java and how you can use it in your code.
- [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, …
Skill Level Advanced
Java Design Patterns: Structuralwith Bethan Palmer1h 38m Intermediate
1. Introduction to Functional Programming
2. First-Class Functions
3. Working with Streams in Java
4. Advanced Concepts
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.