[jira] [Commented] (COLLECTIONS-706) Add SetUtils.asSet(T... items) method

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (COLLECTIONS-706) Add SetUtils.asSet(T... items) method

JIRA jira@apache.org

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

ASF GitHub Bot commented on COLLECTIONS-706:

GitHub user reckart opened a pull request:


    [COLLECTIONS 706] Add set utils.as set method

    PR adds the method described in https://issues.apache.org/jira/projects/COLLECTIONS/issues/COLLECTIONS-706 .
    Could be discussed how to handle this case:
    The compile will warn (at least in Eclipse) that this actually means passing a null array as the var-args argument.
    * Right now, I implemented it such that in this case, the method will return `null`.
    * It might be arguable to better return an empty set in this case.
    * It could even be argued to return a set with the value `null` in this case.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/reckart/commons-collections feature/COLLECTIONS-706-Add-SetUtils.asSet-method

Alternatively you can review and apply these changes as the patch at:


To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #64
commit dc9510d3550c4ea2b700414287944ee02f9db21c
Author: Richard Eckart de Castilho <rec@...>
Date:   2018-12-03T15:42:55Z

    [COLLECTIONS-706] Add SetUtils.asSet(T... items) method
    - Added asSet() method
    - Added unit test

commit 221aaf037ec5f67f4d282d64a244cf358c829582
Author: Richard Eckart de Castilho <rec@...>
Date:   2018-12-03T15:44:10Z

    [COLLECTIONS-706] Add SetUtils.asSet(T... items) method
    - Made JavaDoc more precise.


> Add SetUtils.asSet(T... items) method
> -------------------------------------
>                 Key: COLLECTIONS-706
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-706
>             Project: Commons Collections
>          Issue Type: New Feature
>            Reporter: Richard Eckart de Castilho
>            Priority: Major
> Add an equivalent to the Arrays.asList() method for conveniently creating sets. A trivial implementation would be:
> SetUtils.asSet(T... items) -> return Collections.unmodifiableSet(new HashSet<>(asList(items));

This message was sent by Atlassian JIRA