Re: [Vala] Does Vala.HashMap works ?



* G.S.Alex <sthots gmail com> [04.01.2010 07:05]:
this code is almost the same with the  libgee example.
but the value haspmap will always be 0 for int , (null) for string.

--------------------------------------------------------------------------------------------------------------
using Vala;
static int main (string[] args) {

    var map = new Vala.HashMap<string, int> ();
    map.set ("one", 1);
    map.set ("two", 2);
    map.set ("three", 3);
    map["four"] = 4;            // same as map.set ("four", 4)
    map["five"] = 5;
//  foreach (string key in map.keys) {
        stdout.printf ("%d\n", map["two"]);       // same as map.get (key)
//  }

    return 0;
}
--------------------------------------------------------------------------------------------------------------
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
1. you don't set a hash and equal function which leads to direct hashing
2. why don't you use Gee?

-- 
IRC: playya @ Freenode, Gimpnet
xmpp: playya draugr de

Attachment: signature.asc
Description: Digital signature



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