Skip to content

[java] [6.0.0] ForLoopCanBeForeach false-positive #784

@boris-petrov

Description

@boris-petrov
for (Iterator<E> iterator = iterator(), otherIterator = other.iterator(); iterator.hasNext();) {
	E item = iterator.next();
	E otherItem = otherIterator.next();
	...
}

This code should not give a ForLoopCanBeForeach warning. At least I can't see another way of going through a couple of collections at the same time with a foreach. Am I wrong?

Metadata

Metadata

Assignees

Labels

a:false-positivePMD flags a piece of code that is not problematic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions