Java2blog Profile
Java2blog

@java2blog

Followers
3K
Following
895
Media
17
Statuses
1K

Java2blog is a @Java blog .Follow to learn #Java #Algorithms #Programming #DataStructure #Android #SpringFramework #Hibernate

Joined November 2009
Don't wanna be here? Send us removal request.
@java2blog
Java2blog
5 years
In-depth guide to Java 8 Stream API https://t.co/1KRmYb2lEr
0
5
17
@java2blog
Java2blog
2 years
How to write a lambda expression in a way that you will never forget. A Thread 🧵
1
1
1
@java2blog
Java2blog
2 years
Can We Have Try without Catch Block in Java
1
0
0
@java2blog
Java2blog
2 years
Break Statement in Java with examples https://t.co/4G0BKnE9EA
0
0
0
@java2blog
Java2blog
5 years
In-depth guide to Java 8 Stream API https://t.co/1KRmYb2lEr
0
5
17
@java2blog
Java2blog
2 years
class A { synchronized void m1() { System.out.println("In m1 A"); } void m2() { System.out.println("In m2 A"); } } There are two threads T1 and T2. T1 is accessing m1 method. Will T2 be able to access m2 method on the same instance at the same time?
1
1
1
@java2blog
Java2blog
2 years
That's a wrap! Please follow @java2blog for more such content.
0
0
0
@java2blog
Java2blog
2 years
Here is an article on lambda expressions to understand it better. https://t.co/M5VirVF8Om
Tweet card summary image
java2blog.com
Code to sort list of movies by name using comparator
1
0
0
@java2blog
Java2blog
2 years
Now, let's say we are given a list of employee objects listOfEmployees and we need to obtain a list of the names of employees. Here, we will use the map() method of the Stream API that takes a Function as a parameter.
1
0
0
@java2blog
Java2blog
2 years
Let's use this method to write the Function functional interface.
1
0
0
@java2blog
Java2blog
2 years
Step 3:  Write the implementation similar to a method which takes String as input and returns nothing. Please note that we need to use curly braces {} and a return statement when we want to execute multiple statements.
1
0
0
@java2blog
Java2blog
2 years
Step 2 : Put Array Operator
1
0
0
@java2blog
Java2blog
2 years
Step 1: Go to the source code functional interface for which you need to write lambda expressions and copy the parameters of its abstract method. For example: Let's say you want to write lambda expression for Consumer.
1
0
0
@java2blog
Java2blog
2 years
How to write a lambda expression in a way that you will never forget. A Thread 🧵
1
1
1
@java2blog
Java2blog
2 years
You can call Predicate as: boolean b = stringPredicate.test("Hello World!") // returns true That's a wrap! Follow @java2blog for more such content.
0
0
0
@java2blog
Java2blog
2 years
1
0
0
@java2blog
Java2blog
2 years
1
0
0
@java2blog
Java2blog
2 years
To write a Predicate:
1
0
0
@java2blog
Java2blog
2 years
A Predicate is a single-argument functional interface that returns a boolean value, either true or false. It accepts one argument and yields a result as either true or false.
1
0
0