Live data from Hacker News

Modern Java – A Guide to Java 8

github.com

81–90 of 203 posts

Re: Modern Java – A Guide to Java 8

#81
post #25
post #15

This is a really nice overview of the new Java 8 features. I like how this tutorial communicates mostly with code snippets and has "read more" links for most topics. If you are using Java and have not tried Lambda Expressions, method references and default methods, do so now! After that, you'll think "How was I able to live without that?". I also think that the way Java integrates lambda expressions (via functional i…

If you are using Java and have not tried Lambda Expressions, method references and default methods, do so now! After that, you'll think "How was I able to live without that?" I think instead of "How was I able to live without that?", people are more likely to exclaim "about time!"

Depends where on the Blub scale you are. For those above java, sure.

Re: Modern Java – A Guide to Java 8

#82
post #79
post #25

Earlier quoted context omitted.

If you are using Java and have not tried Lambda Expressions, method references and default methods, do so now! After that, you'll think "How was I able to live without that?" I think instead of "How was I able to live without that?", people are more likely to exclaim "about time!"

Java lambdas are no different than an anonymous Runnable or Callable. It's just nicer syntax.

> It's just nicer syntax.

Which is mostly the point. Ultimately, everything is no different from .

Re: Modern Java – A Guide to Java 8

#83

I personally jumped right into Clojure on the jvm without much Java experience. I've found it to be awesome. Is there a non-political reason that someone should choose Java over Clojure (or possibly Scala)? Where does Java shine?

I have been using Java since the first beta, and have written a large pile of Java books (pun not intended), but I too prefer Clojure as a practical, simple to use and simple to read language. That said, Clojure / Java interop is really nice. I frequently find myself simply adding existing Java code to my lein project file.

I would suggest just keep using Clojure and when it makes sense, mix in Java when you want or need to.

Re: Modern Java – A Guide to Java 8

#84
post #66

Earlier quoted context omitted.

With existing Java code and/or a tight timeline with existing skills I can see how that would be the best choice :) I'm thinking more in terms of the surprisingly high proportion of Java developers who have never learned another language since learning Java 10-15 years ago and dismiss any alternatives without ever exploring what else is out there (you clearly don't fall into that category :).

This is quite typical in most companies where devs don't have trainings nor wish to spend time with work in their free time. I bet you will find thousands of C++ devs that don't even know that there are newer versions of C++98. C devs that still use K&R as their guide with C89 code style. And so on. We are the few select ones that care to improve our skills. EDIT: Typos.

> I bet you will find thousands of C++ devs that don't even know that there are newer versions of C++98.

Actually had a guy tell me (in 2006!) that the main problem with C++ was that there was no standard. :|

Re: Modern Java – A Guide to Java 8

#86

I personally jumped right into Clojure on the jvm without much Java experience. I've found it to be awesome. Is there a non-political reason that someone should choose Java over Clojure (or possibly Scala)? Where does Java shine?

I have been using Java since the first beta, and have written a large pile of Java books (pun not intended), but I too prefer Clojure as a practical, simple to use and simple to read language. That said, Clojure / Java interop is really nice. I frequently find myself simply adding existing Java code to my lein project file. I would suggest just keep using Clojure and when it makes sense, mix in Java when you want or…

This might sound like a snarky comment but it is actually not.

If you want a dynamic language on the Java platform; then why not use JavaScript?

There is an easy-to-use engine in Java 8 and JavaScript is widespread and somehow familiar to Java-developers.

Re: Modern Java – A Guide to Java 8

#87
post #65

Earlier quoted context omitted.

Java's way of expressing variance is really awkward (even quite popular libraries get their types wrong as a result), arrays are special-cased into unsoundness, Serializable is a total mess where it could be a perfect example of how to use a type system, there are no higher kinds, the exception system is like a second parallel type system (it even has union types, which would be incredibly useful if you could use the…

Besides null being a potential type for any reference and causing a ton of issues I do not think most Java programmers regularly care about the lack of abstractions like higher-kinded or union types. Would be nice to have, but never have I felt like I needed them. Enum types didn't exist in Java when the Comparable interface was implemented. That's why some API's look old-school by comparison because newer language f…

> I do not think most Java programmers regularly care about the lack of abstractions like higher-kinded or union types. Would be nice to have, but never have I felt like I needed them.

My counterargument would be the popularity of annotation-based libraries in Java. An annotation is basically a place where the official type system has proven inadequate.

Re: Modern Java – A Guide to Java 8

#88
post #42

Where is aysnc await?

CompleteableFuture[1] is the closest we got for now in the JDK. [1] https://docs.oracle.com/javase/8/docs/api/java/util/concurre...

I just started using CompletableFuture last week. The way each method ties your lambdas together without a bunch of type boilerplate is really nice. I still don't have a great handle on all of its methods, though; e.g., what's the difference between get() and join()?

Re: Modern Java – A Guide to Java 8

#89
post #79
post #25

Earlier quoted context omitted.

If you are using Java and have not tried Lambda Expressions, method references and default methods, do so now! After that, you'll think "How was I able to live without that?" I think instead of "How was I able to live without that?", people are more likely to exclaim "about time!"

Java lambdas are no different than an anonymous Runnable or Callable. It's just nicer syntax.

they are implemented in a different way, using dynamic invocation. the practical implications of the implementation don't come up too often but they are there, so it's probably good to understand.
Post reply on HN