Re: [Vala] Problem with Gee
- From: Nicolas <c r n a wanadoo fr>
- To: ptitjes free fr, vala-list gnome org
- Subject: Re: [Vala] Problem with Gee
- Date: Mon, 05 Oct 2009 10:42:56 +0200
Hi Didier,
Thanks for your response,
I'm learning programming, so don't hesitate to contact me in french, i
must understand than english.
So, if i use "Map<string, int> map = new TreeMap<string,int> ();"
instead of "var map = new HashMap<string, int> ();" the result is the same !
The only solution i found is using this (in genie):
list.add(value)
dict.set(value, "something")
for o in list
type = dict[o]
print "key is " + o
print "value is " + type
Nicolas.
Hi Nicolas,
HashMap do not maintain order for its keys. In contradiction to that, TreeMap is
a map that naturally maintains ordering of its entries, by using the supplied
comparison function, of the standard comparison function for the key type.
Thus you could do:
Map<string, int> map = new TreeMap<string,int> ();
On that map, you can do insertion of the entries in any order, the resulting
entries will always be sorted by its keys.
I hope this is what you wanted.
Best regards, Didier.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]