[Base] Shortcut method for "otherwise(when())" combinations

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8u20
    • Component/s: javafx
    • Environment:

      JDK 8u20, Win 7 Pro SP1, 64 Bit

      The "When" class is rather useful to implement "if-then-else" bindings. We noticed that from time to time we write code to the following pattern...

      When(x = v1).then(a).otherwise(when(x = v2).then(b).otherwise(c))

      ...which simply spoken is a "switch" binding.

      Particularly for larger "switch" bindings it would be nice if this could be shortened to...

      When(x = v1).then(a).otherwiseWhen(x = v2).then(b).otherwise(c)

      ...to reduce the level of parenthesis; or even simplified to...

      Switch(x).case(v1, a).case(v2, b).default(c)

      ...which would be really unambiguous to read! :-)

            Assignee:
            Nir Lisker
            Reporter:
            Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: