Name: krT82822 Date: 08/13/99
This isn't really a feature request, more of an optimization
request. Its also closely related to bug #4206052
There is no need for more than two instances of Boolean
at any time during the life of the VM. They are of course
Boolean.TRUE and Boolean.FALSE. A quick search for the string
"new Boolean" turned up several dozen instances where Java creates
a new object when a simple TRUE or FALSE would do.
- "new Boolean(true)" & "new Boolean(false)" should be replaced
with "Boolean.TRUE" & "Boolean.FALSE" respectively.
- "new Boolean(b)" where b is a boolean expression should be
replaced with "b ? Boolean.TRUE : Boolean.FALSE".
- "new Boolean(s)" where s is a String should be replaced with
"Boolean.valueOf(s)", especially if the improvements listed
in bug #4206052 are implemented.
If these improvements are made you will see an increase in speed
since no object needs to be created and a lighter load on the
garbage collector due to fewer objects.
(Review ID: 93906)