Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

List Class Reference

#include <coherence/util/List.hpp>

Inherits Collection.

Inherited by AbstractList [virtual], and WrapperCollections::AbstractWrapperList [virtual].

List of all members.


Detailed Description

An ordered collection (also known as a sequence).

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.

See also:
Collection
Author:
js/nsa 2008.01.03

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.

Member Function Documentation

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.

Parameters:
i  the position to insert the element at
oh  the element to add
Returns:
true iff this list was modified as a result of this operation
Exceptions:
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.

Parameters:
i  the index of the list to add the elements to
vc  the collection to add to this list
Returns:
true iff this list was modified as a result of this operation
Exceptions:
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.

Parameters:
i  the position of the item to return
Returns:
the element from the specified position in the list
Exceptions:
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.

Parameters:
i  the position of the item to return
Returns:
the element from the specified position in the list
Exceptions:
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.

Parameters:
v  The object in the list to return the index of
Returns:
the position of the object if found, or List::npos

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.

Parameters:
v  The element to search for in the list
Returns:
the position of the element if found, or List::npos

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.

Parameters:
i  the index to start the ListIterator at
Returns:
a ListIterator for this list start at index

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.

Parameters:
i  the index to start the ListIterator at
Returns:
a ListIterator for this list start at index

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.

Parameters:
i  the index from which to remove an element
Returns:
the element at the specified position prior to this operation
Exceptions:
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.

Parameters:
i  the position in the list to replace
oh  the object to replace at the specified position
Returns:
the element at the specified position prior to this operation
Exceptions:
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).

Parameters:
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).
Returns:
the new sublist of this list

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).

Parameters:
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).
Returns:
the new sublist of this list

Implemented in CircularArrayList, CircularArrayList::SubCircularArrayList, LinkedList, LinkedList::SubLinkedList, ReadOnlyMultiList, and WrapperCollections::AbstractWrapperList.


The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.