News for hackers. Stuff that matters.
Re:Java Turns 25 – Whats Next? [pdf] by lchengify on Sunday September 20, 2020 @01:33PM (#24535557)
Other than Effective Java, I recommend looking at some of the Google libraries, specifically Guava [1] and Guice [2] for dependency injection.

Java is fundamentally a slow adopter of new techniques (it just got lambdas in JDK 8), but a lot of the Google libraries fill in the gaps.

Note that if you are learning Java for Android development, that's a whole different sub-discipline. In that case I recommend the Android tutorials since most of the work is dealing with the Android SDK.

[1] https://www.tutorialspoint.com/guava/index.htm

[2] https://www.baeldung.com/guice

Re:Java Turns 25 – Whats Next? [pdf] by rzwitserloot on Sunday September 20, 2020 @01:49PM (#24535723)
> (it just got lambdas in JDK 8)

Interesting use of the word 'just'. At the risk of making readers feel old... Java 8 was released _6 and a half years ago_.

Re:Java Turns 25 – Whats Next? [pdf] by lchengify on Sunday September 20, 2020 @06:14PM (#24537887)
Point taken. For some reason, a lot of the code work i've encountered is tied to JDK 8. Might be due to it having LTS until 2018 [1].

It could be anecdotal, but I've found in practice vendors and companies are conservative about their JDK upgrades. I haven't seen anything prior to JDK 6 in a while, but I don't think the upgrade cycle is as fast as say, python minor version upgrades.

[1] https://en.wikipedia.org/wiki/Java_version_history

Re:Java Turns 25 – Whats Next? [pdf] by ThePadawan on Sunday September 20, 2020 @02:49PM (#24536293)
Maybe as a point of comparison (I wondered): C# got them in C# 3.0 in 2007.
Re:Java Turns 25 – Whats Next? [pdf] by billyjobob on Monday September 21, 2020 @01:21AM (#24540075)
Many Java shops are only just upgrading to JDK 8 though.
Re:Java Turns 25 – Whats Next? [pdf] by saagarjha on Sunday September 20, 2020 @08:15PM (#24538544)
You're making me feel old, and I'm not even old. Or perhaps I should blame codebases that are still trying to be Java SE 1.6 compatible…
Re:Java Turns 25 – Whats Next? [pdf] by bird_monster on Sunday September 20, 2020 @01:55PM (#24535782)
Java got lambdas in the most recent quarter of its development.
Re:Java Turns 25 – Whats Next? [pdf] by vips7L on Sunday September 20, 2020 @02:21PM (#24536016)
I would recommend against guava in any modern form of Java. It doesn't provide much over the standard library.

As for guice, my preference for reflective runtime injection is Weld since it's the standard reference implementation.

Re:Java Turns 25 – Whats Next? [pdf] by bsoft16385 on Sunday September 20, 2020 @05:39PM (#24537632)
I would still recommend Guava for immutable collections, and for the caching classes, both of which are much better than trying to piece things together on your own.

There are a lot of features that have been subsumed into the JDK, and you should usually prefer the JDK implementation where available. Guava has deprecated the redundant functionality, so if you pay attention to your IDE you will be fine.

Re:Java Turns 25 – Whats Next? [pdf] by vips7L on Sunday September 20, 2020 @06:47PM (#24538074)
I'm not really obsessed with immutability. Does Collections.unmodifiable{List,Set,Map,Collection} not do it for you?

I did forget about the cache's though! Good call.

Re:Java Turns 25 – Whats Next? [pdf] by hilbertseries on Monday September 21, 2020 @01:55AM (#24540251)
Guava's immutable collections are superior to Collections.unmodifiable which just wraps the collection in a delegating class that will throw an exception if any of the modifying methods are called. Guava's classes are their own implementations, this is particularly notable for Guava's ImmutableSet which has significantly better memory usage than HashSet. Partially owing to how lazily Java's HashSet is defined, which is a wrapper around Java's HashMap. Meaning that for each element in a HashSet you get an unnecessary Map.Entry wrapper, along with its references. The difference is quite noticeable if you have a set with ~400k Integers. At a certain point, you should also move on to something like Trove, but the guava immutable classes are nice in that you still get the collections interfaces.
Re:Java Turns 25 – Whats Next? [pdf] by ako on Sunday September 20, 2020 @01:49PM (#24535724)
JDK 8 was released march 2014, so "just got lambdas" should be read as over 6 years ago...
Re:Java Turns 25 – Whats Next? [pdf] by tomc1985 on Sunday September 20, 2020 @02:47PM (#24536280)
Yeah, it is up to JDK 15 now
Re:Java Turns 25 – Whats Next? [pdf] by dehrmann on Sunday September 20, 2020 @06:22PM (#24537931)
Knowing what Guava offers is useful, but I try to avoid it, especially in libraries, because it has a history of breaking changes. The Apache Commons libraries are versioned better and a little more focused.

Protobuf (another Google Java product) also made big breaking changes in libraries between 2 and 3.

Re:Java Turns 25 – Whats Next? [pdf] by dcminter on Sunday September 20, 2020 @01:43PM (#24535661)
Broadly I agree, but JDK 8 was released in 2014, so while Java is certainly conservative you're overplaying it there.

The relatively recent adoption of the 6 monthly release cadence is helping a lot - particularly with the small feature additions that used to get stuck behind the release train.