Re: [Vala] Libgee's Roadmap proposal



Hi Julien,

Julien Fontanet wrote:
Didier "Ptitjes" <ptitjes    > writes:
Yeah. I agree on that, hence my question in the first mail about
exposing an interface for map entries (that key/value pairs).

How is that possible, the methods' signatures do not match:
  - Collection.add (G item) vs. Map.set (K key, V value)
  - Collection.contains (G item) vs. Map.contains (K key)
  - Collection.remove (K item) vs. Map.remove (K key)

Collection implements Iterable which provides this method: Iterator<G>
iterator () whereas it should be Iterator<Pair<K, V>> iterator () for Map.

Map could not derive from Collection, but yet it can define a method to
return a Collection of Entries:

public Collection<Map.Entries<K, V>> get_entries ();

I propose that we define a special container Entries, with special
properties "key" and "value", and not that we reuse Pair which would
have some generically-named properties "e1" and "e2" (or element1,
element2).

Best regards, Didier.





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