Comment 3 for bug 1789952

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: Sikuli Java App completely frozen with findAll

sorry for the delay.

The reason behind:
Per definition (see docs of findAll()), the returned Iterator does only step to the next iteration, if the current is consumed (done by using it.next()).

This means you implementation with only using hasNext() is an endless loop by default.

Conclusion: It is not possible to count the matches of findAll() without consuming the matches.
So if you need the matches later, you have to store them whicle counting.

There is convenience feature findAllList(), that returns a List<Match>, which is empty on no success.
see docs:
https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.findAll