gotcha. Calling `.filter` for a concrete class of a Collection (like ArrayList, HashMap, etc.) doesn't produce a lazy iterator but an intermediate collection of an appropriate type. Which means that simply by looking at `items.filter { .. }` you have no idea if it's lazy or not. Gotta check what `items` is.

In most languages I know such functions (along with `map` and other functional stuff) tend to produce lazy results which you can then reify if needed.

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!