You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/07/17 18:23:00 UTC
[jira] [Commented] (COLLECTIONS-600) Make CollectionUtils (in
particular isEqualCollection) null-safe
[ https://issues.apache.org/jira/browse/COLLECTIONS-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16090235#comment-16090235 ]
ASF GitHub Bot commented on COLLECTIONS-600:
--------------------------------------------
Github user asfgit closed the pull request at:
https://github.com/apache/commons-collections/pull/22
> Make CollectionUtils (in particular isEqualCollection) null-safe
> ----------------------------------------------------------------
>
> Key: COLLECTIONS-600
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-600
> Project: Commons Collections
> Issue Type: Improvement
> Components: Collection
> Affects Versions: 4.1
> Reporter: Jonas Holtkamp
> Priority: Minor
>
> Other Commons {{*Utils}} classes as StringUtils etc. feature null-safe methods. Why doesn't for example {{CollectionUtils#isEqualCollection}} include a null check, like this?
> {code} public static boolean isEqualCollection(final Collection<?> a, final Collection<?> b) {
> if(a == null || b == null) {
> return false;
> }
> if(a.size() != b.size()) {
> return false;
> }
> final CardinalityHelper<Object> helper = new CardinalityHelper<Object>(a, b);
> if(helper.cardinalityA.size() != helper.cardinalityB.size()) {
> return false;
> }
> for( final Object obj : helper.cardinalityA.keySet()) {
> if(helper.freqA(obj) != helper.freqB(obj)) {
> return false;
> }
> }
> return true;
> }
> {code}
> I considered filing a Pull Request but wanted to ask here first.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)