[ https://issues.apache.org/jira/browse/COLLECTIONS-540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14258854#comment-14258854 ]
ASF GitHub Bot commented on COLLECTIONS-540: -------------------------------------------- GitHub user ielatif opened a pull request: https://github.com/apache/commons-collections/pull/6 [COLLECTIONS-540] Duplication of code in CollectionUtils You can merge this pull request into a Git repository by running: $ git pull https://github.com/ielatif/commons-collections trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-collections/pull/6.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #6 ---- commit cb78878bce77099720e1f726f06dad0100f7b2e3 Author: ielatif <issam.elatif.prestata...@sfr.com> Date: 2014-12-25T21:06:04Z [COLLECTIONS-540] Duplication of code in CollectionUtils ---- > 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 > > 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)