Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-11832

Replace Map.get() with Map.getOrDefault()

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • Trunk
    • Upcoming Branch
    • ALL COMPONENTS
    • None

    Description

      Map.getOrDefault method could be used to replace the code like this:

      BigDecimal currentTotalPrice = productWeight.containsKey(product) ? productWeight.get(product) : BigDecimal.ZERO;

      Replace with:

      BigDecimal currentTotalPrice = productWeight.getOrDefault(product, BigDecimal.ZERO);
      

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            pawan Pawan Verma
            pawan Pawan Verma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment