You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Geoffrey De Smet (JIRA)" <ji...@apache.org> on 2008/02/19 16:54:43 UTC
[jira] Commented: (COLLECTIONS-286) New util method:
CollectionUtils.getSingleton(List singletonList) which returns the
single object in the list or throws an exception
[ https://issues.apache.org/jira/browse/COLLECTIONS-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570279#action_12570279 ]
Geoffrey De Smet commented on COLLECTIONS-286:
----------------------------------------------
that method should be static
> New util method: CollectionUtils.getSingleton(List<T> singletonList) which returns the single object in the list or throws an exception
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: COLLECTIONS-286
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-286
> Project: Commons Collections
> Issue Type: New Feature
> Reporter: Geoffrey De Smet
> Fix For: 3.3
>
>
> public <T> T getSingleton(List<T> singletonList)
> {
> if (singletonList.size() != 1)
> {
> throw new IllegalArgumentException("The singletonList size ("
> + singletonList.size() + ") should be 1.");
> }
> return singletonList.get(0);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.