Re: [Vala] [Libgee][RFC] Making Map<K, V> a Collection<Map.Entry<K, V> - Was: Libgee's Roadmap proposal



2009/7/24 Fredderic <magentus gmail com>:
On Fri, 24 Jul 2009 02:21:14 +0200,
Jiří Zárevúcky <zarevucky jiri gmail com> wrote:

2009/7/24 Ali Sabil <ali sabil gmail com>:
On Thu, Jul 23, 2009 at 10:32 AM, Didier "Ptitjes"<ptitjes free fr>
Please comment and argue ;)
Could you please explain the rationale behind this change ? What
would be the benefit from  turning a Map into a collection of Pair ?

Efficient iteration over all the Map's elements. Otherwise you'd have
to retrieve a collection of keys and lookup corresponding value for
every single one of them.

Why not simply make Collections contain objects adhering to a
CollectionElement interface which would cover equality testing (about
all the collection ever really needs to do), returning of the elements
value (which may or may not be the same as the data being equality
tested), and generally considered immutable (no standard "set"
method).  Since the collection only needs to know how to handle
CollectionElement's, there's no problem with types.  You obtain the
element, and invoke it's get_value() method.

[...]


Honestly, I wouldn't use such classes if I had to implement every
collection by myself.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]