Name: krT82822 Date: 10/29/99
java version "3.0.2"
Classic VM (build 3.0.2-Tue-Jul-20-10:15:23-PDT-1999-build-37, native threads)
I often need to convert a boolean intrinsic into the appropriate existing
Boolean. I can of course instantiate a new Boolean around the given true or
false value, but the Boolean class already contains perfectly good ones for
which I don't have to pay the instantiation costs. My code is littered with
<boolean expr> ? Boolean.TRUE : Boolean.FALSE
and I'm tired of writing and looking at it. The Boolean class should have a
static method that does this:
Boolean.for(true) -> Boolean.TRUE
Boolean.for(false) -> Boolean.FALSE
It will take about three minutes to implement and document this. Little
conveniences like this make a language much nicer to use.
(Review ID: 97232)
======================================================================
- duplicates
-
JDK-4206052 java.lang.Boolean improvements
-
- Resolved
-