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 2015/06/29 22:35:04 UTC

[jira] [Commented] (COLLECTIONS-541) Add CollectionUtils.getRandom() method

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

Thomas Neidhart commented on COLLECTIONS-541:
---------------------------------------------

I do not like the fact that there is a Random instance in CollectionUtils that can not be initialized with a seed. Thus the getRandom(Collection) method will not be deterministic.

Also passing an empty Collection should be handled gracefully. Ideally the method should return an Optional instance, but this is only available starting with Java 8 (and adding our own version does not make sense imho).

Postponing to a later release, as it is not really critical and only a nice-to-have feature.

> Add CollectionUtils.getRandom() method
> --------------------------------------
>
>                 Key: COLLECTIONS-541
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-541
>             Project: Commons Collections
>          Issue Type: New Feature
>            Reporter: Thomas Neidhart
>            Priority: Minor
>             Fix For: 4.x
>
>
> Placeholder ticket for pull request: https://github.com/apache/commons-collections/pull/5



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