LinkedList


Object Hierarchy:

Object hierarchy for LinkedList

Description:

public class LinkedList<T> : Object

A doubly-linked list that supports efficient insertion and removal at both ends.

LinkedList provides O(1) addFirst/addLast and removeFirst/removeLast. It can be used as a queue, stack, or deque. Inspired by Java's LinkedList and Go's container/list.

For element comparison in methods like contains() and indexOf(), pass an equality function to the constructor. For string lists, use GLib.str_equal.

Example:

    var list = new LinkedList<string> (GLib.str_equal);
list.addLast ("a");
list.addLast ("b");
list.addFirst ("z");
assert (list.peekFirst () == "z");
assert (list.peekLast () == "b");
assert (list.size () == 3);


Namespace: Vala.Collections
Package: Valacore

Content:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class GLib.Object