Live data from Hacker News

Modern Java – A Guide to Java 8

github.com

51–60 of 203 posts

Re: Modern Java – A Guide to Java 8

#51
post #17

> maps don't support streams This is very misleading. There is not a #stream method on Map because Map supports three different streams: map.keySet().stream() map.values().stream() map.entrySet().stream()

Thanks for your feedback. I've improved the section about maps to better reflect the capabilities of streaming maps:

https://github.com/winterbe/java8-tutorial/blob/master/READM...

Re: Modern Java – A Guide to Java 8

#52
post #49

Earlier quoted context omitted.

OK, what then is Java The point was that if one has a proper old-school computer science (to realize the crucial importance of first class procedures and the power of uniformity 20 years ago) all these modern features are coming for free, to which the code above is an illustration. But who cares. There is a whole industry which praised Java for almost two decades even without these "modern features". Any PL student o…

Yes, and now that Java finally has these modern features: people are migrating to GO who lack many :( But then LISPs have always been shunned for bad reasons. While crazy bad languages like C,Java and PHP are picked up by the masses.

But there are really modern things. Julia, for example, and Scala is even a bit too modern.)

Re: Modern Java – A Guide to Java 8

#53
Enjoy these features while you can.

It's a matter of time until your team lead takes a glance at the code-base, deems them unreadable and "too clever" (as in "where am I going to find cheap developers now?") and makes you revert all the way back to Java 6.

Re: Modern Java – A Guide to Java 8

#54

Earlier quoted context omitted.

> Is there a non-political reason that someone should choose Java over Clojure (or possibly Scala)? Where does Java shine? If you are stuck with a group of developers who have no interest in learning anything new and wish to use Java until they retire then Java is the only choice. Other than no new learning required I can't think of many reasons to pick Java as a first choice. Java tends to be popular because it's th…

>If you are stuck with a group of developers who have no interest in learning anything new and wish to use Java until they retire then Java is the only choice. Put another way: if you're on a dev team where nobody knows Clojure/Scala, and everyone knows Java, (and, optionally, the codebase is already in Java), and your team doesn't have time for everyone to learn an entirely new language (including cleaning up the be…

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 :).

Re: Modern Java – A Guide to Java 8

#55
post #49

Earlier quoted context omitted.

OK, what then is Java The point was that if one has a proper old-school computer science (to realize the crucial importance of first class procedures and the power of uniformity 20 years ago) all these modern features are coming for free, to which the code above is an illustration. But who cares. There is a whole industry which praised Java for almost two decades even without these "modern features". Any PL student o…

Yes, and now that Java finally has these modern features: people are migrating to GO who lack many :( But then LISPs have always been shunned for bad reasons. While crazy bad languages like C,Java and PHP are picked up by the masses.

Your JVM runs on all things written in C and the concurrency primitives are far more elegant in Go than in Java.

Re: Modern Java – A Guide to Java 8

#56
post #28
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!"

Yep, somewhere at Xerox PARC in the early 80's coll := ((1 to: 100) select: [:x| ( x * x ) > 3]) collect: [:x | (x * 2)].

And a whole world of Standard ML in the early 90's

Re: Modern Java – A Guide to Java 8

#57
post #7

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?

There's a gravitational pull towards popular languages because popular languages have more books, more (idiomatic) libraries and tools, copy-pasteble examples all over the web and a big pool of developers that can be productive from day 1 on simple problems. In order to adopt a language that isn't in the top 6 or so, you've got to have good reasons for it. And depending on the problems you're trying to solve, sometim…

I don't know how you can find even average Java code unreadable. If anything it's incredibly verbose. Only now with the most recent features is it really likely that you'll run into some one-liners and magic functions. Now, if you were talking about frameworks/app servers and not being able to figure out which levers and knobs to push to get them to behave, I would agree wholeheartedly.

I'm not saying Java is good looking by any means, but I've never found it to be heard to read in the "I can't completely grasp exactly what everything is supposed to do" kind of way. I often find Python and JS to have enough shortcuts, callbacks, and anonymous functions to find other people's code much harder to grok than other people's Java.

Re: Modern Java – A Guide to Java 8

#58
post #55
post #49

Earlier quoted context omitted.

Yes, and now that Java finally has these modern features: people are migrating to GO who lack many :( But then LISPs have always been shunned for bad reasons. While crazy bad languages like C,Java and PHP are picked up by the masses.

Your JVM runs on all things written in C and the concurrency primitives are far more elegant in Go than in Java.

Agree and disagree. The thing I was going for is that compscience advantages don't seem to matter for language adoption. i.e. popularity does not correlate to compsci purity.

Re: Modern Java – A Guide to Java 8

#59
post #17

> maps don't support streams This is very misleading. There is not a #stream method on Map because Map supports three different streams: map.keySet().stream() map.values().stream() map.entrySet().stream()

Those methods are not on Map, but on Set and Collection.

Re: Modern Java – A Guide to Java 8

#60
post #31
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!"

Well... depends on who you ask. I, personally, was more in the "about time!" camp. But I have met several programmers who didn't think they'd need those "newfangled features" at first. Especially in the "early days" of Java 8... And sometimes I still meet people like that. So that scentence was targeting those developers that are still stuck with Java 5 or 6 or 7 and have never tried Java 8. Also, I was once co-teach…

I have that experience with lots of companies:

Very little LINQ usage, usually Java 6 still the latest version on the servers, C++ code older than ANSI C++98....

Post reply on HN