I understand what both do when I read the definition, and then I sit down to write an
expression and pick the wrong one about half the time. Is there a way to think about it that
sticks?
The framing that finally made it stick for me:
selectchanges how many. Same kind of thing, fewer of them.
orders->select(total > 1000)is still orders.collectchanges what kind. Different kind of thing, same number of them.
orders->collect(customer)is customers, not orders.
So ask yourself what the result is made of. If the answer is the same noun you started
with, you want select. If it is a different noun, you want collect.
The type checker catches it one line later either way, but knowing which you meant before you
type it is faster.
‘What is the result made of’ — that is the question I was missing. Thank you.
Borrowing this for teaching. The noun test is much better than the definition.