ssiva raman wrote:why there two provided by sdk 2?
I can find lot of ideas but want to know what is the right approach
Monica Shiralkar wrote:What would be a good simple example?
And wanted to ask that while lambdas were introduced in Java 8, was it possible to write to above code using anonymous class before Java 8 ?
Paul Clapham wrote:Sure. Even today, 15 years after Java 8 was released, you'll find Swing code using anonymous classes to respond to events. It's not necessarily that there's a learning curve, it's just easier to write code the same way as you did before, or the same way as the tutorials you're copying from. And most people wouldn't go back and change existing working code to use lambdas, either.
giannis vout wrote:I was expecting 1,1 since sheep++ returns the original value before increment.
Monica Shiralkar wrote:Thanks all. Is it so that while Java was having higher order functions before Java 8 but largely a lot of higher order functions were added in Java 8.?
Like the forEach method taking lambda expressions as argument.
Another example is comparator taking lambda expression as argument. Comparator has been since earlier in Java, but was ability of comparator to take lambda expression as argument in Java from earlier or got added in Java 8?
annomous
And despite these added in Java 8, if someone wanted to use functional programming in Java but not comfortable yet with lambda expressions then they were using annomous classes only until they would get familiar with lambda expressions in Java.
Paul Anilprem wrote:That depends on the isolation level.