[
https://issues.apache.org/jira/browse/COLLECTIONS-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Neidhart resolved COLLECTIONS-540.
-----------------------------------------
Resolution: Fixed
Fix Version/s: 4.1
Fixed in r1647955.
Additionally, I added an overloaded method for Enumeration and also moved the
code from get(Object, int) there.
Thanks for the report and the patches!
> 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)