I need to keep only unique values and I am confused which data structure should I use. Later on I will only read the whole data structure.
MapSet which will contain only unique elements.Enum.member? whether an item is already there - but I can easily guarantee that through MapSet.I am not sure which approach is better to use in such scenario. Which is more efficient, and which is better practice?
If you keep your data in a MapSet, then Enum.member? will in fact call MapSet.member? underneath, so you will have all advantages of MapSet. You can see the relevant protocol implementation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With