You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jonathan Pepin (Jira)" <ji...@apache.org> on 2020/11/03 14:58:00 UTC
[jira] [Commented] (LANG-470) Add containsAll methods to ArrayUtils
[ https://issues.apache.org/jira/browse/LANG-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17225472#comment-17225472 ]
Jonathan Pepin commented on LANG-470:
-------------------------------------
Hi,
Let me re-open discussion, the topic is old, and Java usages and implementations has a lot evolved since wont-fix decision.
In our project, we create our proper ArrayUtils to statisfy "lacks" of org.apache.commons.lang3.ArrayUtils
We have implemented this containsAll
{code:java}
public static <T> boolean containsAll(T[] elementsToCompare, T[] elementsToFound) {
return elementsToFound.length == 0 || Arrays.asList(elementsToCompare)
.containsAll(Arrays.asList(elementsToFound));
}
{code}
I will curious to have critism about this implementation.
Ok there is no null cheking in this implementation, it can be an enhancement to add.
I call you to revalue the addition of a containAll in ArrayUtils, not necesseray our example of implementation, but the best accepted implementation after reflexion / discussion.
> Add containsAll methods to ArrayUtils
> -------------------------------------
>
> Key: LANG-470
> URL: https://issues.apache.org/jira/browse/LANG-470
> Project: Commons Lang
> Issue Type: New Feature
> Components: lang.*
> Affects Versions: 2.4
> Reporter: Maarten Coene
> Priority: Major
> Attachments: ArrayUtilsContainsAll.pat
>
>
> The ArrayUtils class contains several "contains" methods.
> It could be usefull to add the corresponding containsAll(Object[] array1, Object[] array2) methods (and corresponding for primitive types).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)