#include <coherence/util/List.hpp>
Inherits Collection.
Inherited by AbstractList [virtual]
, and WrapperCollections::AbstractWrapperList [virtual]
.
The user of this interface 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. Unlike sets, lists typically allow duplicate elements.
The List interface places additional stipulations, beyond those specified in the Collection interface, on the contracts of the iterator, add, remove, equals, and hashCode methods.
Public Types | |
typedef spec::Handle | Handle |
List Handle definition. | |
typedef spec::View | View |
List View definition. | |
typedef spec::Holder | Holder |
List Holder definition. | |
Public Member Functions | |
virtual bool | add (size32_t i, Object::Holder oh)=0 |
Add the given element to this collection at the position specified. | |
virtual bool | addAll (size32_t i, Collection::View vc)=0 |
Add all the elements from the supplied collection to this collection at the position specified. | |
virtual Object::Holder | get (size32_t i) const =0 |
Return the element from the specified position in the list. | |
virtual Object::Holder | get (size32_t i)=0 |
Return the element from the specified position in the list. | |
virtual size32_t | indexOf (Object::View v) const =0 |
Return the position in the list of the first instance of the specified element. | |
virtual size32_t | lastIndexOf (Object::View v) const =0 |
Return the position in this list of the last instance of the specified element. | |
virtual ListIterator::Handle | listIterator (size32_t i=0) const =0 |
Return a ListIterator for this list starting at index. | |
virtual ListMuterator::Handle | listIterator (size32_t i=0)=0 |
Return a ListIterator for this list starting at index. | |
virtual Object::Holder | remove (size32_t i)=0 |
Remove the element at the specified position in the list. | |
virtual Object::Holder | set (size32_t i, Object::Holder oh)=0 |
Replace the element at the specified position in this list with the specified element. | |
virtual List::View | subList (size32_t iFrom, size32_t iTo) const =0 |
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive). | |
virtual List::Handle | subList (size32_t iFrom, size32_t iTo)=0 |
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive). | |
Static Public Attributes | |
static const size32_t | npos |
The largest possible value of type size32_t. |
virtual bool add | ( | size32_t | i, | |
Object::Holder | oh | |||
) | [pure virtual] |
Add the given element to this collection at the position specified.
If an element is already at that position it will be shifted to the right by 1.
i | the position to insert the element at | |
oh | the element to add |
coherence::lang::IndexOutOfBoundsException | if the index is out of range |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual bool addAll | ( | size32_t | i, | |
Collection::View | vc | |||
) | [pure virtual] |
Add all the elements from the supplied collection to this collection at the position specified.
i | the index of the list to add the elements to | |
vc | the collection to add to this list |
coherence::lang::IndexOutOfBoundsException | if the inedex is out of range |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual Object::Holder get | ( | size32_t | i | ) | const [pure virtual] |
Return the element from the specified position in the list.
i | the position of the item to return |
coherence::lang::IndexOutOfBoundsException | if the index is out of range |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual Object::Holder get | ( | size32_t | i | ) | [pure virtual] |
Return the element from the specified position in the list.
i | the position of the item to return |
coherence::lang::IndexOutOfBoundsException | if the index is out of range |
Implemented in AbstractList, and WrapperCollections::AbstractWrapperList.
virtual size32_t indexOf | ( | Object::View | v | ) | const [pure virtual] |
Return the position in the list of the first instance of the specified element.
v | The object in the list to return the index of |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual size32_t lastIndexOf | ( | Object::View | v | ) | const [pure virtual] |
Return the position in this list of the last instance of the specified element.
v | The element to search for in the list |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual ListIterator::Handle listIterator | ( | size32_t | i = 0 |
) | const [pure virtual] |
Return a ListIterator for this list starting at index.
i | the index to start the ListIterator at |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, TypedCollections::TypedList, and WrapperCollections::AbstractWrapperList.
virtual ListMuterator::Handle listIterator | ( | size32_t | i = 0 |
) | [pure virtual] |
Return a ListIterator for this list starting at index.
i | the index to start the ListIterator at |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, TypedCollections::TypedList, and WrapperCollections::AbstractWrapperList.
virtual Object::Holder remove | ( | size32_t | i | ) | [pure virtual] |
Remove the element at the specified position in the list.
i | the index from which to remove an element |
coherence::lang::IndexOutOfBoundsException | if the index is out of range |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual Object::Holder set | ( | size32_t | i, | |
Object::Holder | oh | |||
) | [pure virtual] |
Replace the element at the specified position in this list with the specified element.
i | the position in the list to replace | |
oh | the object to replace at the specified position |
coherence::lang::IndexOutOfBoundsException | if the index is out of range |
Implemented in CircularArrayList, LinkedList, ReadOnlyMultiList, SubList, and WrapperCollections::AbstractWrapperList.
virtual List::View subList | ( | size32_t | iFrom, | |
size32_t | iTo | |||
) | const [pure virtual] |
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive).
iFrom | the start position in this list to create the sublist from (inclusive). | |
iTo | the end position in this list to end the sublist at (exclusive). |
Implemented in CircularArrayList, CircularArrayList::SubCircularArrayList, LinkedList, LinkedList::SubLinkedList, ReadOnlyMultiList, and WrapperCollections::AbstractWrapperList.
virtual List::Handle subList | ( | size32_t | iFrom, | |
size32_t | iTo | |||
) | [pure virtual] |
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive).
iFrom | the start position in this list to create the sublist from (inclusive). | |
iTo | the end position in this list to end the sublist at (exclusive). |
Implemented in CircularArrayList, CircularArrayList::SubCircularArrayList, LinkedList, LinkedList::SubLinkedList, ReadOnlyMultiList, and WrapperCollections::AbstractWrapperList.