Composition is when you take some number of smaller, simpler functions and combine them into a single, more complex function. Learn how to create a compose function and use it to modify user data in a functional manner.
- [Instructor] The last advanced functional concept … that we're going to look at in this course, … is something called composition. … So, roughly speaking, composition is when we take a series … of smaller modular functions and we combine them … into one more complex function. … A simple example of this would be if we took … some very simple mathematical function, … such as doubling or subtracting one from a number. … And then we combined them … into a more complex mathematical function. … So, for example, here, … we're taking the functions X times two, … and X minus one and combining them into the function, … two X minus one. … So, that's the basic concept of composition. … Why don't we head over to our IDE … and take a look at what this actually … is going to look like in code. … So, let's define these two functions here. … So, we'll have one function takes an integer as an argument … and returns an integer. … And we'll call this times two. … And it's simply going to take an argument …
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.