List
Object Hierarchy:
Description:
[
Compact ]
[
CCode ( dup_function =
"g_list_copy" , free_function =
"g_list_free" ) ]
public class List<
G>
The List struct is used for each element in a doubly-linked list.
Example: Apply a function to each element:
public static int main (string[] args) {
List<string> list = new List<string> ();
list.append ("1. entry");
list.append ("2. entry");
list.append ("3. entry");
// Output:
// ``1. entry``
// ``2. entry``
// ``3. entry``
list.foreach ((entry) => {
print (@"$entry\n");
});
return 0;
}
valac --pkg glib-2.0 GLib.List.foreach.vala
Content:
Creation methods:
Methods:
- public void @foreach (Func<G> func)
- public void append (owned G data)
- public void concat (owned List<G> list2)
- public List<unowned G> copy ()
- public List<G> copy_deep (CopyFunc<G> func)
- public void delete_link (List<G> link_)
- public unowned List<G> find (G data)
- public unowned List<G> find_custom (G data, CompareFunc<G> func)
- public unowned List<G> first ()
- public int index (G data)
- public void insert (owned G data, int position)
- public void insert_before (List<G> sibling, owned G data)
- public void insert_before_link (List<G> sibling, owned List<G> link_)
- public void insert_sorted (owned G data, CompareFunc<G> compare_func)
- public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func)
- public inline bool is_empty ()
- public unowned List<G> last ()
- public uint length ()
- public unowned List<G> nth (uint n)
- public unowned G nth_data (uint n)
- public unowned List<G> nth_prev (uint n)
- public int position (List<G> llink)
- public void prepend (owned G data)
- public void remove (G data)
- public void remove_all (G data)
- public unowned List<G> remove_all_full (G data, FreeFunc? func)
- public unowned List<G> remove_full (G data, FreeFunc? func)
- public void remove_link (List<G> llink)
- public void reverse ()
- public unowned List<G> search<T> (T data, SearchFunc<G,T> func)
- public void sort (CompareFunc<G> compare_func)
- public void sort_with_data (CompareDataFunc<G> compare_func)
Fields: