commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (COLLECTIONS-286) New util method: CollectionUtils.extractSingleton(Collection<T> coll) which returns the single object in the list or throws an exception
Date Tue, 23 Apr 2013 18:47:17 GMT

     [ https://issues.apache.org/jira/browse/COLLECTIONS-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart updated COLLECTIONS-286:
----------------------------------------

    Summary: New util method: CollectionUtils.extractSingleton(Collection<T> coll) which
returns the single object in the list or throws an exception  (was: New util method: CollectionUtils.getSingleton(List<T>
singletonList) which returns the single object in the list or throws an exception)
    
> New util method: CollectionUtils.extractSingleton(Collection<T> coll) 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: 4.0
>
>         Attachments: extract.svn.diff
>
>
>     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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message