You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2013/02/24 22:18:12 UTC

[jira] [Resolved] (COLLECTIONS-370) Add method MapUtils.putIfNotNull

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

Thomas Neidhart resolved COLLECTIONS-370.
-----------------------------------------

    Resolution: Implemented

MapUtils already contains a method which does exactly what is suggested: safeAddToMap.

Thus closing this issue as already implemented.
                
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira