[jira] [Commented] (OFBIZ-11832) Replace Map.get() with Map.getOrDefault()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-11832) Replace Map.get() with Map.getOrDefault()

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-11832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17142219#comment-17142219 ]

ASF subversion and git services commented on OFBIZ-11832:
---------------------------------------------------------

Commit 30732dd57b4d54a32a65eab487fdd7de796360ee in ofbiz-framework's branch refs/heads/trunk from Pawan Verma
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=30732dd ]

Improved: Replace Map.get() with Map.getOrDefault() method.(OFBIZ-11832)

Set checkstyleMain.maxErrors to 26682 (-2)


> Replace Map.get() with Map.getOrDefault()
> -----------------------------------------
>
>                 Key: OFBIZ-11832
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11832
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL COMPONENTS
>    Affects Versions: Trunk
>            Reporter: Pawan Verma
>            Assignee: Pawan Verma
>            Priority: Minor
>         Attachments: OFBIZ-11832.patch
>
>
> Map.getOrDefault method could be used to replace the code like this:
> {code:java}
> BigDecimal currentTotalPrice = productWeight.containsKey(product) ? productWeight.get(product) : BigDecimal.ZERO;{code}
> Replace with:
> {code:java}
> BigDecimal currentTotalPrice = productWeight.getOrDefault(product, BigDecimal.ZERO);
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)