mutant icon indicating copy to clipboard operation
mutant copied to clipboard

Add mutation of #map to #to_set

Open dkubb opened this issue 2 years ago • 0 comments

The Enumerable#to_set method can accept a block like Enumerable#map and it will return a Set containing unique entries.

If the return value of #map (a) Doesn't need to include duplicates or (b) Needs to be an Array because the public interface of the method says it must be an Array, then we would expect appropriate tests to ensure this property holds.

If neither of these is the case, then a Set can often function just as well as an Array, and perhaps even better if the assumption is that there can be no duplicate entries.

dkubb avatar Jul 21 '21 19:07 dkubb