Uploaded image for project: 'Parquet'
  1. Parquet
  2. PARQUET-1723

Read From Maps Without Using Contains

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.12.0
    • None

    Description

      I see a few places with the following pattern...

       

      
      if (map.contains(key)) {
      
         return map.get(key);
      
      }
      

      Better to just call get() and then check the return value for 'null' to determine if the key is there. This prevents the need to traverse the Map twice,... once for contains and once for get.

      Attachments

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: