Re: [Vala] Problem with Gee
- From: Martin Olsson <mnemo minimum se>
- To: Nicolas <c r n a wanadoo fr>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Problem with Gee
- Date: Sun, 04 Oct 2009 17:40:03 +0200
Nicolas wrote:
static int main (string[] args) {
var map = new 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[key]); // same as map.get (key)
}
return 0;
}
Also, instead of looping for .keys and checking map[key] for each one you can get
a signicifant perf boost if you loop over .entries instead (for new libgee versions).
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]