It might work for a List, depending on implementation. But looking up something in a list requires iterating anyway, so you don't really gain anything. It probably won't work at all for a Set, because ...
Some results have been hidden because they may be inaccessible to you
Show inaccessible results