Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4286410

Boolean.for(boolean aTrueOrFalseIntrinsic)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.2
    • core-libs
    • generic
    • generic



      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)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: