The second implication of first-class functions is that you can pass functions as arguments to other functions. Learn what this looks like in Java and how you can use it in your code.
- So now that we've seen how we can treat functions in the … same way as other types, … such as integers, strings or other objects. … The next step is to look at how we can pass functions as … arguments to other functions. … So up until now, … you've probably been used to passing arguments into … functions with the purpose of specifying what the data is … that we're operating on. … So if we pass two numbers into a function called add … for example, … we're specifying the … two numbers that we want to add together. … But what if instead of passing arguments into … our function to specify what our data is, … we could pass in arguments to … specify what was done to that data. … This is one of the important things that … first class functions let us do. … Now to illustrate this point … let's imagine that we have a class called my math … which we'll define up here. … We're going to say protected, static class, my math. … And let's say that … this class has two very simple static methods. …
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.