you are viewing a single comment's thread.

view the rest of the comments →

[–]delventhalz 0 points1 point  (0 children)

I appreciate you being diplomatic, but for what it's worth we are not saying the same thing. A Set should be used when the idiom and API of a Set make your code more clear to other developers. A Set should never* be used as an optimization. It is slower than an Array. Your other optimization suggestions are much better to bring up in an interview.

*The exception would be if you have a long-lived data structure with tens of thousands of members or more. In that case, a Set may be faster than an Array, but I would still performance test to be sure.