Garrett Smith wrote:
> JavaScript does not provide basic functionality for unique collections.
>   

It's trivial to implement an efficient Set class even in ES3 (with
certain restrictions on the "type" of the key) - just use objects which
are pretty much specialized hash tables (maps from string to values,
keys collides with prototype keys). For ES4, we have maps which are hash
tables as bareboned as you'll get in the language. I'm not sure why you
have all those |!Map.containsKey(lisx[i])| checks in your Map example,
since they're totally unnecessary.

A SortedSet is a bit trickier, because that would require some sort of
binary search tree to be efficient. But it can be done.
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to