commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (COLLECTIONS-370) Add method MapUtils.putIfNotNull
Date Fri, 27 Nov 2015 21:48:13 GMT

     [ https://issues.apache.org/jira/browse/COLLECTIONS-370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart closed COLLECTIONS-370.
---------------------------------------

> Add method MapUtils.putIfNotNull
> --------------------------------
>
>                 Key: COLLECTIONS-370
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-370
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Tom Pasierb
>            Priority: Minor
>         Attachments: COLLECTIONS-370.patch
>
>
> Add method MapUtils.putIfNotNull that adds the given value to the map only if it is not
null.
> Possible implementation:
> public static <K, V> void putIfNotNull(Map<K, V> map, K key, V value) {
> 	if (value != null) {
> 		map.put(key, value);
> 	}
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message