Vala: list_iterator added
This commit is contained in:
parent
2222a0a59d
commit
9c11aa58fe
|
@ -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");
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
valac --Xcc='-w' --pkg=gee-0.8 list_iterator.vala && ./list_iterator
|
Loading…
Reference in New Issue