|
I was actually wondering myself when I wrote it but could not crystalize out a reason then.And I disagree (not violently <grin> but I do disagree).
It is basically my personal experience in what gives the least resistance in the long run, where I have reached that conclusion.And in my personal experience, while I don't use double and float for the reasons you've stated, Thorbjørn, I prefer to use int for true integer values. However, I don't find a whole lot of integers in the real world; primarily counts. If Java had a true fixed precision primitive, I would use it all the time, and this would be a bigger issue.
Primitive types are not objects so they cannot be subclassed if different behaviour is needed. They cannot be used as parameters to methods expecting an object (like slf4j which I use a lot), and ALWAYS require special treatment everywhere. They cannot have a descriptive toString method!I don't think this is a good reason to add the overhead of an Integer. Unless I'm mistaken, you can turn anything into String by just coding ""+intValue. And class variables don't need toString; that's the job of the containing class.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.