In this video, Kathryn introduces lambda functions as anonymous functions, and shows you how to use them in Java. Lambda functions are very useful when you want to create a function quickly without the usual overhead.
- [Narrator] In the past, whenever we've created a function,…we've always had to put it inside a class.…With lambda, we can get around this.…Lambdas are anonymous functions that you can create easily…in Java without the usual overhead of public, static,…void, etc.…It is a great tool if you need a quick function…for a calculation in your code.…Let's take a look at an example of this in Java.…Here on line eight is an example of how lambda syntax works.…Usually in your functions, you'd have an access modifier,…that's your public, private, etc.,…a return type, which would be void…and double whatever your function's returning,…and the name of the function.…
We don't do that here with lambda functions…and that's what make them anonymous functions.…Instead, we just have the parameters,…which in this case are none…and then put the body of the code immediately after…with a dash arrow and write the body of the code,…which is return "Hello."…This is erring right now…because there are a couple of other things…we need to set up, but let's take a look at another example…
Author
Released
3/21/2018- Downloading Java 9 and choosing an IDE
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Debugging
- Working with inheritance and interfaces
- Learning lambda
Skill Level Beginner
Duration
Views
Related Courses
-
Advanced Java Programming
with David Gassner3h 33m Advanced
-
Introduction
-
Welcome34s
-
-
1. Getting Started
-
Exploring JShell3m 50s
-
Exploring an IDE2m 11s
-
Hello World in Java4m 6s
-
2. Java Basics
-
How do we create code?2m 8s
-
Variables and data types4m 6s
-
Strings7m 12s
-
Arrays8m 48s
-
Exploring documentation3m 1s
-
-
3. Control Flow
-
Decision-making with IF5m 37s
-
Comparing loops5m 18s
-
Debugging with an IDE4m 16s
-
Solution: Dice Roll4m 3s
-
4. Beyond the Basics
-
What is encapsulation?6m 40s
-
Working with inheritance9m 12s
-
Interfaces6m 6s
-
Functional programming1m 4s
-
Learning lambda7m 14s
-
Conclusion
-
Next steps37s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Learning lambda