Bizarre, I admit, but there's an explanation. The method findAllIn
returns an Iterator -- you need to iterate over it to interact with
it. In the first case, the REPL called "toString" on it, which got it
to check the existence of the first element. In the second case, you
called a method directly without first asserting the existence of the
element.
IMHO, having MatchIterator extend MatchData was a bad design decision
-- Iterators should be Iterators, not Data. As bad design decisions
go, however, this one is mostly harmless -- it mostly breaks broken
code.
--
Daniel C. Sobral
I travel to the future all the time.