[
https://issues.apache.org/jira/browse/COLLECTIONS-540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259053#comment-14259053
]
ASF GitHub Bot commented on COLLECTIONS-540:
--------------------------------------------
Github user asfgit closed the pull request at:
https://github.com/apache/commons-collections/pull/6
> 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)