You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Pawan Verma (Jira)" <ji...@apache.org> on 2020/06/17 12:57:00 UTC

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

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

Pawan Verma commented on OFBIZ-11832:
-------------------------------------

Attached patch for this improvement. 

> 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)