filmov
tv
Java 8 New Features Tutorials - 08 : Method reference | Static Method Reference | Part - 1
![preview_player](https://i.ytimg.com/vi/aTQFhh5E6ng/maxresdefault.jpg)
Показать описание
In this video we are discussing about Method Reference .
Types of Method References :
Static Method Reference
Non Static Method Refrence
Bound Reciever
Unbound Reciever
Constructor Reference
This Refrence
Super Reference
Passing Lambda function as Method parameter :
static predicateCheck(int a, MyPredicate ref){
}
Case- 1 :
MyPredicate pred =(a)-a%2==0;
predicateCheck(10, pred);
Case- 2 :
predicateCheck(10, (a)-a%2==0);
Problem Statement :
we have a list of interger and wanted to perform some operations
1 - Sum of all numbers
2 - Sum of all Even Numbers
3 - Sum of all Odd Numbers
Lambda Expression is enabling Functional Programming in java 8.
Through Lambda Expression we can pass block of code as parameter of a method.
Lambda Expression is also known as Method Anonymous implementation.
Lambda Supports Higher Order Function implementation and Lazy Evaluation methods.
Lambda Expression :
- Block of code which take some inputs and return output.
- Enabling Functional Programming.
- Anonymous Method implementation.
Pre-Condition :
can work on FunctionalInterface only
Pro :
More readable code
Store block of code in a variable
we can pass an implentation as an argument of a method
Cons : in some cases we dont get methods in IDE
==========================================================
Lambda Expression Syntax :: (args)-{stmnt};
==========================================================
Lambda Expression works with Functional Interface only .
Case -1 :a) No Method Argument with no return type (void method_name();)
b) No Method Argument with return type (R method_name();)
Case -2 :a) One Method Argument with no return type (void method_name(T t);)
b) One Method Argument with return type (R method_name(T t);)
Case -3 :a) More Than One Arguments with no return type (void method_name(args...);)
b) More Than One Arguments with return type (R method_name(arg..);)
===================================
Java,
Java 8,
Java 8 Tutorials,
Java 8 features,
Java 8 features in Hindi,
Java 8 New Features,
Java Tutorials for beginners,
Java 8 Tutorials for beginners,
lambda expression ,
lambda expression in java,
lambda,
Functional Interface,
Default Methods in interface,
Static Methods in Interface,
Method Anonymous Implementation,
Stream API,
Collectors,
GroupingBy,
PartitioningBy,
ToList,
multithreading using lambda expression,
exception handling using lambda expression,
Optional Class,
String Joiner class,
Collection Enhancement
etc.
Types of Method References :
Static Method Reference
Non Static Method Refrence
Bound Reciever
Unbound Reciever
Constructor Reference
This Refrence
Super Reference
Passing Lambda function as Method parameter :
static predicateCheck(int a, MyPredicate ref){
}
Case- 1 :
MyPredicate pred =(a)-a%2==0;
predicateCheck(10, pred);
Case- 2 :
predicateCheck(10, (a)-a%2==0);
Problem Statement :
we have a list of interger and wanted to perform some operations
1 - Sum of all numbers
2 - Sum of all Even Numbers
3 - Sum of all Odd Numbers
Lambda Expression is enabling Functional Programming in java 8.
Through Lambda Expression we can pass block of code as parameter of a method.
Lambda Expression is also known as Method Anonymous implementation.
Lambda Supports Higher Order Function implementation and Lazy Evaluation methods.
Lambda Expression :
- Block of code which take some inputs and return output.
- Enabling Functional Programming.
- Anonymous Method implementation.
Pre-Condition :
can work on FunctionalInterface only
Pro :
More readable code
Store block of code in a variable
we can pass an implentation as an argument of a method
Cons : in some cases we dont get methods in IDE
==========================================================
Lambda Expression Syntax :: (args)-{stmnt};
==========================================================
Lambda Expression works with Functional Interface only .
Case -1 :a) No Method Argument with no return type (void method_name();)
b) No Method Argument with return type (R method_name();)
Case -2 :a) One Method Argument with no return type (void method_name(T t);)
b) One Method Argument with return type (R method_name(T t);)
Case -3 :a) More Than One Arguments with no return type (void method_name(args...);)
b) More Than One Arguments with return type (R method_name(arg..);)
===================================
Java,
Java 8,
Java 8 Tutorials,
Java 8 features,
Java 8 features in Hindi,
Java 8 New Features,
Java Tutorials for beginners,
Java 8 Tutorials for beginners,
lambda expression ,
lambda expression in java,
lambda,
Functional Interface,
Default Methods in interface,
Static Methods in Interface,
Method Anonymous Implementation,
Stream API,
Collectors,
GroupingBy,
PartitioningBy,
ToList,
multithreading using lambda expression,
exception handling using lambda expression,
Optional Class,
String Joiner class,
Collection Enhancement
etc.