[Gtk-sharp-list] Preventing Dups In a ListStore
felipe.lessa at gmail.com
Fri Jan 4 20:31:10 EST 2008
On Jan 4, 2008 10:36 PM, Michael Hutchinson <m.j.hutchinson at gmail.com> wrote:
> AFAIK you'd have to iterate it (though ForEach will simplify this). Of
> course, that's what a Contains () call would do anyway -- if you want
> O(1) contains calls, you'd need a hashtable, but a list obviously
> needs... a list.
Yes, that's the problem. It would be O(n) for a naïve approach.
Another option (besides hashtables, trees, etc) would be to store an
additional field on each entity stating that it was already included
or not, but of course this depends on how your code works, as it may
be not possible.
More information about the Gtk-sharp-list