will android java support lambda expression in java 8?-ThrowExceptions

Exception or error:

I understand that the “java” in a dalvik vm is different from Java se in terms of API and architecture etc. But the syntax has always been the same. (Please correct me if I am wrong)

Now the support of lambda expression in java 8 is about to be released, will android java follow it? did google or aosp promise on making dalvik consistent with java se?

UPDATE: Now as in Android 4.4 Kit Kat (API 19), Java 7 syntax has been OFFICIALLY supported.Source from android.com

How to solve:

Android doesn’t use Oracle’s Java SE versions, it’s based on parts of the Apache Harmony project so it doesn’t even support Java 7. Harmony is not actively developed any more and won’t support 1.7.

Unless Google decides to upgrade Harmony and the Android SDK to a newer Java version, there won’t be any Java 7 or Java 8 features in Android – even if new features are just syntactical. They could use an alternative implementation like the OpenJDK, though I don’t know of any plans for this. Some people think the use of OpenJDK is unlikely because of lawsuits between Google and Oracle.

Some features of Java 7, most notable: diamond operators, multi-catch, string switch and in Android N also some Java 8 features like lambda expressions have been implemented in Android since this answer was written. (Thanks to Ross and Stefan for mentioning it in the comments).

Google has to implement those features by their own effort and it seems that the choose to do so mostly for more popular features.

Leave a Reply

Your email address will not be published. Required fields are marked *