[Vala] No foreach through HashMap<string, string> ?



Hi all,

I'm not sure if I've read it somewhere already, so I have to ask again (sorry). Isn't it possible to iterate 
though a Gee.HashMap if its key and value are of the same type?

Having

Gee.HashMap<string, string> foo = new Gee.HashMap<string, string>();

//I can't do

foreach(Gee.Map.Entry<string, string> bar in foo){}

..because I get the error:

Cannot convert from `int' to `string'
                foreach(Gee.Map.Entry <string, string> bar in foo)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

..where the key seems to be treated as an int here.

$valac --version
Vala 0.29.1


If that's expected behavior, do you know any practical workarounds?

Thanks a bunch.

gilzad


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