For reasons I dare not mention, I had to install version 7 of the JDK a couple of months ago. As a Mac user, my usual way of installing is using Homebrew. To install a JDK, this is as easy as brew cask install adoptopenjdkx, where x is the Java version. It didn’t work, as AdoptOpenJDK provides no version 7. It took me some time to find a JDK 7. In the end, I found one in Zulu - thanks to Azul. Coupled to the fact that I also learned Alibaba provided a JDK and I got curious: how many
Some time ago, I described a couple of surprising design choices in the JDK functional interfaces API. Lately, during a lesson, a student of mine proposed to shallow-copy an ArrayList by using the clone() method: I thought this is another API gotcha worth writing about. Cloning an object means a new object is created with the same state as the original one. As per the JavaDoc: Creates and returns a copy of this object. The precise meaning of 'copy' may depend on the class of the object.