Make Parent.getDescendants return Iterable too #70

Closed
rolfl opened this Issue Mar 16, 2012 · 0 comments

Projects

None yet

1 participant

@rolfl
Collaborator
rolfl commented Mar 16, 2012

for (Element table : root.getDescendants(
tableFilter)) {
tableCount++;
}

The compile-time error that I get states, "Can only iterate over an array or an instance of java.lang.Iterable". Since Element.getDescendants (Filter) returns a java.util.Iterator, I would expect my code to compile and work. What am I missing?

Sincerely,
Craig

Hi Rolf,

my suggestion:

create an Interface IterableIterator that implements both interfaces
(Iterable, Iterator) and make this the new return type. This will keep
the compatibility and allows those fancy for loops.

Regards

Thomas

@rolfl rolfl closed this in 27bb470 Mar 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment