Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • "As a variant of this, you may implement a FooHandler in a similar manner, which does not just fill a list, but does the foo processing directly in-place." -- that's the part that I'm trying to figure out how to do --- should onFoo()/onBar()/onBaz() be generators and if so, how do I do that? I'm hitting a mental block, and because there may be cases where there are hundreds of items (such as tag elements in HTML, although in my case there are only 3 or 4 different types of items, and without that level of hierarchy) I'd prefer not to collect the entire list first and then process. Commented Jan 28 at 18:13
  • 1
    @JasonS You could add an optional filter parameter to scanner or just a list of types you want emitted. Commented Jan 28 at 18:23
  • @JasonS: my second suggestion gives you a generator solution. What exactly are you still missing ? Commented Jan 28 at 21:31