Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4875

Add a safe index operator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.0.0
    • syntax
    • None

    Description

      It would be nice if there were a safe navigation operator for subscripts.

      Safe navigation operator:
      a?.b

      Safe index operator:
      a.size() > 0 ? a[0] : null => a?[0]

      Attachments

        Activity

          People

            Unassigned Unassigned
            balor123 Uri Moszkowicz
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: