5 ms·
>When we asked Google why now, the company pointed to to the release of Java 8 last year and the introduction of new language features such as lambdas. As such,
by ubertaco 11y ago
>When we asked Google why now, the company pointed to to the release of Java 8 last year and the introduction of new language features such as lambdas. As such, Google wants to put more resources into OpenJDK where the team can have a bigger impact on new features and improvements. That’s the developer story Google is pitching in any case, but there’s a massive legal narrative here that can’t be forgotten.
Yes, the legal narrative is certainly key here, but as a dev I'm all for a move that brings Java 8 to Android instead of just Java 6. It's about time!
- kuschku 11y agoYou wanna know what I did? 1. Use RetroLambda 2. Write your own implementation of Streams and Optionals, compatible with RxJava and Guava 3. Use in your project 4. Profit
- benwilber0 11y agowell that doesn't really scale at all though
- s73v3r 11y agoNo one should expect everyone to do that. This is basic, platform level stuff, that Google should be providing, unless they want Android to stagnate and whither away.
- kuschku 11y agoObviously. But by now most have accepted that Google is just unable to provide any reasonable solution to this, and built their own libraries. Often (ButterKnife, NineOldAndroids, etc) even better than what Google themselves provide.
- meagain20000 11y agoPlease explain it like I'm five: what is the big deal about lamdas?
- ianhedoesit 11y agoI think this StackExchange question is pretty useful. http://programmers.stackexchange.com/questions/107687/what-is-the-origin-and-meaning-of-the-phrase-lambda-the-ultimate http://programmers.stackexchange.com/questions/107687/what-i...
- jholman 11y agoI will assume, for the purpose of this answer, that you mean "what is the big deal about Java 8 getting lambdas?". For other meanings of your question, see other replies. In (pre-8) Java, variables can only hold primitive values or objects (in Java, an object is an instance of a class [c.f.]). Similarly, arguments to a method must all be primitive values or objects. This is kinda crazy, by which I mean hilariously limiting. It's often useful to pass around other types of things, including types (in Java that'd be primitive types or classes or interfaces), or functions, or partially applied functions, or whatever. Of course, Java doesn't have functions, only methods. Whoops. See http://steve-yegge.blogspot.ca/2006/03/execution-in-kingdom-of-nouns.html http://steve-yegge.blogspot.ca/2006/03/execution-in-kingdom-... for a bit of snark about how silly this whole situation is. So Java programmers, while desperately lacking in aesthetic taste (I keed, I keed) and largely blinkered by the java-cultural context in which they find themselves, turn out to be a pretty clever lot after all. Clever enough that despite their language, they come up with all these conventions for doing things like passing around types and functions and so on. So you get ideas like the Runnable interface, wherein one makes a class just so that it can have a static method (perhaps called "run") that does what the function would do, and you then instantiate that class, and pass the instance, just so it can be used to get at the "run" method. It works, but it's oh so ugly. So finally, after twenty years of this suffering, now Java programmers have some nice new syntactic sugar, to allow them to pass functions around with less explicit ceremony, thereby catching up with advanced languages like Python, C, Lisp, and basically everything except Cobol. Of course, under the hood it's still Predicate<T>, a generic type that represents a functional interface, which is a new bit of jargon they came up with to shoehorn this elementary functionality into their baroque conceptual framework. And you furthermore, in Java 8 you can even declare them anonymously (unlike e.g. C, AFAIK), to expedite the most common use case, which is passing a function as an argument to a higher-order function (like "map" or whatever). They're called "lambdas" because of the existence of the lambda calculus, an abstraction for computing that uses nothing but anonymous functions, and because many other languages have therefore referred to their anonymous function syntax as "lambdas" (Python even uses "lambda" as a keyword for this). So the big deal about lambdas in Java is that Java has one less vile pain point. (Any five-year-old could understand this explanation, right?)