3 ms·
Because it's a nightmare with ridiculous missing hunks, like the fact that you can't put anything but primitive types in a Set usefully. Why would you use it to
by madhadron 7y ago
Because it's a nightmare with ridiculous missing hunks, like the fact that you can't put anything but primitive types in a Set usefully. Why would you use it to teach?
- mirekrusin 7y agoYes, I'd have lesson explaining it's behavior, how it works any why it works this way and maybe assign homework to extend it to support uniqueness based on structural equality.
- madhadron 7y agoYou can't extend it to support uniqueness based on structural equality, because the Set type uses == to test, and there is no means in the language of overriding that.
- mirekrusin 7y agoYou can extend it, trivial one would be by subclassing and overriding methods to iterate over all entries doing deep-equal. Better complexity can be achieved by hashing (doesn't need to be collision free) and scanning subsets per hash etc.