My colleague told me that I should use float whenever possible to reduce object creation and improve performance. Java silently converts a float to a Float (this requires some processing power) when necessary. Therefore, it seems to me that the only need for Float is when you need to use the Float object very often, rather than its primitive.
When you look at java.awt.color, it uses Float, perhaps unnecessarily.
When do you need to prefer Float over float in Java?
Dรกvid Tรณth
source share