You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Daniel Stewart (JIRA)" <ji...@apache.org> on 2014/12/25 03:37:13 UTC
[jira] [Created] (COLLECTIONS-540) Duplication of code in
CollectionUtils
Daniel Stewart created COLLECTIONS-540:
------------------------------------------
Summary: 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)