This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Succeeding with AI and have Veljko Krunic on-line!
See this thread for details.
Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Nandhini Sridharan

Ranch Hand
+ Follow
since Oct 26, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nandhini Sridharan

Okay this is basically as part of method reference. While DefaultableImpl::new refers to constructor reference of DefaultableImpl class.

Thanks.
5 years ago
public static void main( String[] args ) {
2
Defaulable defaulable = DefaulableFactory.create( DefaultableImpl::new );
3
System.out.println( defaulable.notRequired() );
4

5
defaulable = DefaulableFactory.create( OverridableImpl::new );
6
System.out.println( defaulable.notRequired() );
7
}

I recently came across the above code in one of the article. Though I understand that ::new is used to pass the instance of the class. I would love to really read and understand about ::new. Can someone has any article links about it?
5 years ago
Whatever I am trying to ask is that

The default method implementations in interface can be equivalent to the methods defined in the abstract class.
The methods declared in the interface is equivalent to the abstract methods in the abstract class


In a way, we are redefining the abstract class features in interface. With prior to Java 8, Interface has an advantage of multiple inheritance but abstract classes cannot.

But the advantage of the feature introduced in interface, to me is to have the backward compatibility. Meaning, the already existing contract between the interface and the classes would not be broken by defining the new methods within an interface.

Is there anything else other than this is happening with this new feature?
5 years ago
I would like to answer my question by myself

Thanks to the post https://coderanch.com/t/646488/java/java/Core-Java-benefits-lambda-expressions

The advantages of Lambda with respect to Java programming is that

1. It aids less typing (Without beating around the bush, just expresses the actual calculation being made and fading out unnecessary syntax information)
2. The above statement also serves in another way that the programmer is just interested in what is being done (the actual business logic) than the decorating code like public static all those blah blah blah
3. When we pass function as method parameter, the method really need to know what is the result of that function rather than how the result has been achieved
5 years ago
What is the typical difference between abstract class and interface with default methods
5 years ago
I am going over the new features of Java 8. One of them would be Lambda expressions.

I know with Lambda, we can pass functions as method parameters. With respect to mathematical operations, we can pass the function as method parameter. But in what way, does this functionality majorly improves the java capability? Meaning, how are we achieving the most of this functionality with respect to application development?

Can someone throw light on this one?

Thanks
5 years ago
Guys,

I want to learn thoroughly the latest new features introduced and introducing in Java 8 and Java 9.

Can someone lead me to the direction on where exactly I can get this info from?

Thanks,
Geetha
5 years ago
I certainly understand that the same question has been asked and replied in different way by Himai and some other person already.. in this thread https://coderanch.com/t/644912/java-EJB-SCBCD/certification/message-driven-bean-listener-interface

But my question context is little different, I certainly understand that there are many message listeners based on messaging types. If the message listener interface (Like MessageListener interface imposes one method onMessage()), has many methods (like in POJI), MDB has to implement all those methods and the resource adapter will pick up one thats needed?
A Message Driven bean listener interface may define more than one message listener method. The resource adapter will determine which method will be invoked

So, In a typical development environment, The MDB has to define all the methods that are required by Message Listener interface (atleast provide empty implementation for an unwanted message listener method), and the resource adapter will decide on which method to choose?
In chapter 3 on Frits EJB 3.1 notes, its been stated that

A Message Driven bean instance variables can contain state across the handling of messages (e.g. database connection or reference to an enterprise bean).

Q1. Can MDB contain reference to stateful session bean?
Q2. With the statement, instance variables can contain state across the handling of messages Are the stateful session bean state is carried over or as per the DI rule when the MDB instance is destroyed, the DI automatically removes the stateful session bean?