Mission Base

Program Base Library

pblList - List Implementation

List in C, C array list, C-ArrayList, array list in C, ArrayList in C C linked list, C-LinkedList, linked list in C, LinkedList in C.


Documentation

Open source C implementation of an ordered collection (also known as a sequence) similar to the Java List interface. The user of this module has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

The List module provides two implementations of lists, an open source C resizable-array implementation equivalent to the Java ArrayList class and an open source C linked list implementation equivalent to the Java LinkedList class.

Lists allow duplicate elements and they allow multiple NULL elements.

The List module provides four methods for positional (indexed) access to list elements. Lists (like C arrays) are zero based. Note that these operations execute in time proportional to the index value for LinkedList implementation). Thus, iterating over the elements in a list is typically preferable to indexing through it if the caller does not know the implementation.

The List module provides an iterator, called a pblIterator, that allows element insertion and replacement, and bidirectional access in addition to the normal operations iterators provide.

The List module provides two methods to search for a specified object. From a performance standpoint, these methods should be used with caution. They will perform costly linear searches.

The List module provides two methods to efficiently insert and remove multiple elements at an arbitrary point in the list.

All list functions described below work on array lists as well as on linked lists, they of course will show different runtime and memory complexities depending on the type of list used.


Constructors and Destructors

  • pblListNewArrayList Creates a new array list.
  • pblListNewLinkedList Creates a new linked list.
  • pblListClone Returns a shallow copy of this list instance.
  • pblListCloneRange Returns a shallow copy from this list of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
  • pblListFree Free the list's memory from heap.

    Adding to a List

  • pblListAdd Appends the specified element to the end of this list.
  • pblListAddAll Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
  • pblListAddAllAt Inserts all of the elements in the specified collection into this list at the specified position.
  • pblListAddAt Inserts the specified element at the specified position in this list.
  • pblListAddFirst Inserts the given element at the beginning of this list.
  • pblListAddLast Appends the given element to the end of this list.
  • pblListOffer Adds the specified element as the tail (last element) of this list.
  • pblListPush Pushes the specified element to the end (last element) of this list.

    Accessing List Elements

  • pblListContains Returns true if this list contains the specified element.
  • pblListContainsAll Returns a value > 0 if this list contains all of the elements in the specified collection.
  • pblListElement Retrieves, but does not remove, the head (first element) of this list.
  • pblListGet Returns the element at the specified position in this list.
  • pblListGetFirst Returns the first element in this list.
  • pblListGetLast Returns the last element in this list.
  • pblListHead Retrieves, but does not remove, the head (first element) of this list.
  • pblListIndexOf Searches for the first occurrence of the given argument.
  • pblListLastIndexOf Searches for the last occurrence of the given argument.
  • pblListPeek Retrieves, but does not remove, the head (first element) of this list.
  • pblListTail Retrieves, but does not remove, the tail (last element) of this list.
  • pblListTop Retrieves, but does not remove, the tail (last element) of this list.

    Changing Element Data

  • pblListSet Replaces the element at the specified position in this list with the specified element.
  • pblListSetFirst Replaces the head (first element) of this list.
  • pblListSetLast Replaces the tail (last element) of this list.

    Removing from a List

  • pblListPoll Retrieves and removes the head (first element) of this list.
  • pblListPop Retrieves and removes the tail (last element) of this list.
  • pblListRemove Retrieves and removes the head (first element) of this list.
  • pblListRemoveAll Removes from this list all of its elements that are contained in the specified collection.
  • pblListRemoveAt Removes the element at the specified position in this list.
  • pblListRemoveElement Removes a single instance of the specified element from this list, if it is present.
  • pblListRemoveFirst Removes and returns the first element in this list.
  • pblListRemoveLast Removes and returns the last element in this list.
  • pblListRemoveRange Removes from this list all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
  • pblListRetainAll Retains only the elements in this list that are contained in the specified collection.

    Functions on Lists

  • pblListClear Removes all of the elements from this list.
  • pblListClone Returns a shallow copy of this list instance.
  • pblListCloneRange Returns a shallow copy from this list of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
  • pblListDefaultCompare Default compare function used if no application specific compare function is specified by the user.
  • pblListEnsureCapacity Increases the capacity of this list instance, if necessary.
  • pblListEquals Compares the specified collection with this list for equality.
  • pblListFree Free the list's memory from heap.
  • pblListGetCapacity Returns the capacity of this list instance.
  • pblListGetCompareFunction Gets the application specific compare function for the elements of the list.
  • pblListIsArrayList Tests if the object is an array list.
  • pblListIsEmpty Tests if this list has no elements.
  • pblListIsLinkedList Tests if the object is a linked list.
  • pblListIsList Tests if the object is a list.
  • pblListIterator Returns an iterator over the elements in this list in proper sequence.
  • pblListReverse Reverses the order of the elements of this list.
  • pblListReverseIterator Returns a reverse iterator over the elements in this list in proper sequence.
  • pblListSetCompareFunction Sets an application specific compare function for the elements of the list.
  • pblListSetSize Sets the size of a list.
  • pblListSize Returns the number of elements in this list.
  • pblListSort Sorts the elements of the list.
  • pblListToArray Returns an array containing all of the elements in this list in the correct order.
  • pblListTrimToSize Trims the capacity of this list instance to be the list's current size.

    Collection Functions

    Each pblList is also a pblCollection, therefore all collection functions can be used on lists.

  • pblCollectionAggregate Aggregates a collection by calling the aggregation function on every element of the collection while running through the collection with an iterator.
  • pblCollectionContains Returns true if this collection contains the specified element.
  • pblCollectionConvertToArrayList Returns a pblArrayList with a shallow copy of this collection instance.
  • pblCollectionConvertToHashSet Returns a pblHashSet with a shallow copy of this collection instance.
  • pblCollectionConvertToLinkedList Returns a pblLinkedList with a shallow copy of this collection instance.
  • pblCollectionConvertToTreeSet Returns a pblTreeSet with a shallow copy of this collection instance.
  • pblCollectionElementCompare Compare two elements of a collection.
  • pblCollectionIsCollection Tests if the object is a collection.
  • pblCollectionSetCompareFunction Sets an application specific compare function for the elements of the collection.
  • pblCollectionStringCompareFunction Compares two '\0' terminated strings.

    Alphabetic List of List Functions


  • pblListAdd Appends the specified element to the end of this list.
  • pblListAddAll Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
  • pblListAddAllAt Inserts all of the elements in the specified collection into this list at the specified position.
  • pblListAddAt Inserts the specified element at the specified position in this list.
  • pblListAddFirst Inserts the given element at the beginning of this list.
  • pblListAddLast Appends the given element to the end of this list.
  • pblListClear Removes all of the elements from this list.
  • pblListClone Returns a shallow copy of this list instance.
  • pblListCloneRange Returns a shallow copy from this list of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
  • pblListContains Returns true if this list contains the specified element.
  • pblListContainsAll Returns a value > 0 if this list contains all of the elements in the specified collection.
  • pblListElement Retrieves, but does not remove, the head (first element) of this list.
  • pblListEnsureCapacity Increases the capacity of this list instance, if necessary.
  • pblListEquals Compares the specified collection with this list for equality.
  • pblListFree Free the list's memory from heap.
  • pblListGet Returns the element at the specified position in this list.
  • pblListGetCapacity Returns the capacity of this list instance.
  • pblListGetCompareFunction Gets the application specific compare function for the elements of the list.
  • pblListGetFirst Returns the first element in this list.
  • pblListGetLast Returns the last element in this list.
  • pblListHead Retrieves, but does not remove, the head (first element) of this list.
  • pblListIndexOf Searches for the first occurrence of the given argument.
  • pblListIsArrayList Tests if the object is an array list.
  • pblListIsEmpty Tests if this list has no elements.
  • pblListIsLinkedList Tests if the object is a linked list.
  • pblListIsList Tests if the object is a list.
  • pblListIterator Returns an iterator over the elements in this list in proper sequence.
  • pblListLastIndexOf Searches for the last occurrence of the given argument.
  • pblListNewArrayList Creates a new array list.
  • pblListNewLinkedList Creates a new linked list.
  • pblListOffer Adds the specified element as the tail (last element) of this list.
  • pblListPeek Retrieves, but does not remove, the head (first element) of this list.
  • pblListPoll Retrieves and removes the head (first element) of this list.
  • pblListPop Retrieves and removes the tail (last element) of this list.
  • pblListPush Pushes the specified element to the end (last element) of this list.
  • pblListRemove Retrieves and removes the head (first element) of this list.
  • pblListRemoveAll Removes from this list all of its elements that are contained in the specified collection.
  • pblListRemoveAt Removes the element at the specified position in this list.
  • pblListRemoveElement Removes a single instance of the specified element from this list, if it is present.
  • pblListRemoveFirst Removes and returns the first element in this list.
  • pblListRemoveLast Removes and returns the last element in this list.
  • pblListRemoveRange Removes from this list all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
  • pblListRetainAll Retains only the elements in this list that are contained in the specified collection.
  • pblListReverse Reverses the order of the elements of this list.
  • pblListReverseIterator Returns a reverse iterator over the elements in this list in proper sequence.
  • pblListSet Replaces the element at the specified position in this list with the specified element.
  • pblListSetCompareFunction Sets an application specific compare function for the elements of the list.
  • pblListSetFirst Replaces the head (first element) of this list.
  • pblListSetLast Replaces the tail (last element) of this list.
  • pblListSetSize Sets the size of a list.
  • pblListSize Returns the number of elements in this list.
  • pblListSort Sorts the elements of the list.
  • pblListTail Retrieves, but does not remove, the tail (last element) of this list.
  • pblListToArray Returns an array containing all of the elements in this list in the correct order.
  • pblListTop Retrieves, but does not remove, the tail (last element) of this list.
  • pblListTrimToSize Trims the capacity of this list instance to be the list's current size.

    Alphabetic index


    GET PBL:


    Copyright(C) 2003 - 2015 Peter Graf, this software is distributed under the GNU Lesser General Public License.
    This page was generated with the help of DOC++.