bairava surya wrote:As am new to java 8 can you provide the real time example of lambda purpose and its inclusion in java 8(play ground)
Suppose this simple problem: print all the odd numbers in a list of integers greater than 15 without any duplicates.
In Java 7 you'll probable write something like:
The same code in Java 8:
So you'll see immediately 2 (main) advantages:
And as a final note: let's assume the business requirement changes and duplicates are allowed. In the Java 7 code you have to change Set with List and HashSet with ArrayList; but in the Java 8 code you'll just remove the .distinct() line.
Hope it helps!
It's not on the OCA 7/8 exam, so we won't elaborate on this new feature in Java 8 in this forum (to avoid confusion for other aspirants preparing for the OCA 7/8 exam). Just start a new thread with your doubts/questions in the SCJP/OCPJP forum.
bairava surya wrote:As what are some of the strongest concepts that made java 8 most successfull
Without any doubt: lambdas.
bairava surya wrote:and is java8 can be used in android developing?
Currently Java 8 is not supported! You can find more info here.