The measurement has been around for a very long time, and in the early days of Java there was a real performance issue. So they used publicly available variables and made it mutable - two main mistakes to get a few beats.
Everything that you guys ask questions about premature optimization, you can learn a good lesson here. (Added)
The sizes change a lot (when the window is resized), and by changing it, you “save” to select new objects if necessary - just reuse the old one. Which, in the early days of Java, made some sense. In addition, they gained access to many, because the graphical interface drew nested buttons inside the components inside the frames, therefore, to save several cycles when redrawing, do not use the function call. Again, it makes little sense.
The problem is that currently with all multi-core processors and multi-threaded code, you often create protective copies of Dimension. Having lost all this "adrenaline", plus, the source of errors is annoying.
user949300
source share