[Vala] removing an element from a list



Hello,
For an application that I am working on, I need to keep a collection of
strings and possibly remove a string from the collection. A list seems
to be a good way to manage the strings but when I try to remove() or
remove_all(), the list doesn't change. for example:

public static void main(string[] args)
{
        List<string> list = new List<string>();
        list.append("this");
        list.append("is");
        list.append("a");
        list.append("test");
        //remove test
        list.remove_all("test");

        foreach(string word in list)
        {
                stdout.printf("%s ", word );
        }
        stdout.printf("\n");
}

The word "test" is not removed from the list. Am I doing something
wrong, and is there a better way to do what I need?

jezra



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