object - Java: Should I use float or Float? -


this question has answer here:

my colleague told me should use float whenever possible reduce object creation , increase performance. java silently converts float float (this needs computational power) whenever necessary. seems me need float when 1 needs use object float instead of primitive.

when looking @ java.awt.color, using float, perhaps unnecessarily.

when 1 need prefer float on float in java?

the object float can set null represent value unknown.
primitive float guaranteed have value.

there overhead on autoboxing, negligible. still must allocate space primitive there nothing gain there.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -