Vala: list_iterator added

This commit is contained in:
Kolan Sh 2014-04-27 01:54:07 +04:00
parent 2222a0a59d
commit 9c11aa58fe
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,19 @@
public void main () {
var list = new Gee.ArrayList<string> ();
list.add ("Kolan");
list.add ("Inna");
list.add ("Stalk");
print ("--- .foreach method ---\n");
list.foreach ((elem) => { print (elem + "\n"); return true; });
print ("--- foreach (var ---\n");
foreach (var elem in list) print (elem + "\n");
//BAD (doesn't work): for (var it = list.bidir_list_iterator (); it.has_next (); it.next ())
print ("--- Internal iterator ---\n");
var iter = list.bidir_list_iterator ();
for (var has_next = iter.first (); has_next; has_next = iter.next ())
print (iter.get () + "\n");
}

3
vala/list_iterator/run.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
valac --Xcc='-w' --pkg=gee-0.8 list_iterator.vala && ./list_iterator