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.
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.
As for guice, my preference for reflective runtime injection is Weld since it's the standard reference implementation.