Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-182

null coalesce operator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.1.1
    • 3.0
    • all

    Description

      common code often has constructs along the lines of:

      String r = ((v != null) ? v : "default");

      wouldnt this be better handled by a simple operator ?

      groovy has "?:" (http://www.groovy-lang.org/operators.html#_elvis_operator)
      like:

      def r = (v ?: 'default');

      and php 7 now has '??' (http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op)
      like:

      $r = ($v ?? 'default');

      Attachments

        Activity

          People

            henrib Henri Biestro
            terefang Terefang Verigorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: