TreeSet

Benji Smith dlanguage at benjismith.net
Sat Aug 2 12:39:07 PDT 2008


> sorry I meant you can use an associative array with a boolean dummy 
> value, e.g.:
> bool[uint] myset;

It's not *quite* the same.

A java TreeSet<T> uses a red-black tree implementation rather than a 
hashtable implementation (like the java HashSet<T> class). Consequently, 
a TreeSet<T>.ValueIterator will always iterate the values in their 
natural ordering, whereas a HashSet<T>.ValueIterator makes no guarantees 
about its iteration ordering.

I don't know whether Tango provides any equivalent containers. Tango 
definitely has TreeMap and TreeBag implementations, but there doesn't 
seem to be a TreeSet.

http://dsource.org/projects/tango/docs/current/

Someone with more Tango expertise could probably clarify...

--benji



More information about the Digitalmars-d mailing list