Hacker News new | past | comments | ask | show | jobs | submit login

Woah:

>Improved Java 8 language support - We’re excited to bring Java 8 language features to Android. With Android's Jack compiler, you can now use many popular Java 8 language features, including lambdas and more, on Android versions as far back as Gingerbread. The new features help reduce boilerplate code. For example, lambdas can replace anonymous inner classes when providing event listeners. Some Java 8 language features --like default and static methods, streams, and functional interfaces -- are also now available on N and above. With Jack, we’re looking forward to tracking the Java language more closely while maintaining backward compatibility.




While it's certainly a change for the better, personally I find the Streams API is still clunky and lacking. In compare to LINQ, or Kotlin (case in point: http://stackoverflow.com/a/34642255).


I find the fact that streams and functional interfaces are not backwards compatible almost a deal breaker. Using Java 8 streams makes so many things easier that once you start using it, there's no going back. Now you're not going to be able to use it in production till 2019.


When you say "not backwards compatible" do you mean that the streams and functional interfaces aren't compatible with Java in Android N or do you mean that they're not being to be ported to previous versions of Android?


Maybe in general, Java 8 generated bytecode won't run on earlier JVMs, but a lot of shops are still on Java 6/7. (Allegedly.)


As I understood the article, it seems they're not being ported to previous versions of Android.


This has been possible for some time with retrolambda.


In fact, they've implemented lambdas exactly like retrolambda does via anonymous classes.


So this is just another way to blow up your dex method count?


disclaimer: I work on Android dev tools

It depends. For example, let's compare providing an event listener via a lambda vs an anonymous inner class. Using the lambda will increase your method count by 1. However, if you're accessing class member variables, it will reduce the method count for each variable you use, because it's added as a method of the containing class and doesn't need to generate accessors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: