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

Thomas Neidhart closed COLLECTIONS-540.
---------------------------------------

> Duplication of code in CollectionUtils
> --------------------------------------
>
>                 Key: COLLECTIONS-540
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-540
>             Project: Commons Collections
>          Issue Type: Improvement
>    Affects Versions: 4.0
>            Reporter: Daniel Stewart
>            Priority: Trivial
>             Fix For: 4.1
>
>
> In CollectionUtils.get(Object, int) on Line 1250, the code in the condition:
> {code:title=CollectionUtils.java|borderStyle=solid}
> else if (object instanceof Iterator<?>) {
>     final Iterator<?> it = (Iterator<?>) object;
>     while (it.hasNext()) {
>         i--;
>         if (i == -1) {
>             return it.next();
>         }
>         it.next();
>      }
>      throw new IndexOutOfBoundsException("Entry does not exist: " + i);
> }
> {code}
> Can be replaced with just a call to CollectionUtils.get(Iterator, int), on 
> Line 1176.



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

Reply via email to