Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ReadOnlyMultiList Class Reference

`#include <coherence/util/ReadOnlyMultiList.hpp>`

Inherits AbstractList, and Set.

Inherited by ReadOnlyArrayList.

List of all members.

## Detailed Description

Implementation of the List interface in a read-only fashion based on a collection of arrays.

This class also implements the Set interface, although the contents are not checked to determine whether each element is unique. It is the responsibility of the user to ensure that the elements are unique if the object is used as a Set.

Note: while preserved for backward compatibility, as of Coherence 3.6, use of this class specifically as a List or a Set is deprecated. Instead, the getList(), getSet() methods should be used.

Author:
  gg, mf 2009.1.20

Since:
  Coherence 3.6

See also:
  ReadOnlyArrayList

## Public Types
typedef spec::Handle | Handle
| ReadOnlyMultiList Handle definition.
typedef spec::View | View
| ReadOnlyMultiList View definition.
typedef spec::Holder | Holder
| ReadOnlyMultiList Holder definition.
typedef this_spec::Handle | Handle
| AbstractList Handle definition.
typedef this_spec::View | View
| AbstractList View definition.
typedef this_spec::Holder | Holder
| AbstractList Holder definition.
## Public Member Functions
virtual List::Handle | getList ()
| Return a List view of this ReadOnlyMultiList.
virtual List::View | getList () const
| Return a List view of this ReadOnlyMultiList.
virtual Set::Handle | getSet ()
| Return a Set view of this ReadOnlyMultiList.
virtual Set::View | getSet () const
| Return a Set view of this ReadOnlyMultiList.
virtual size32_t | size () const
| Return the number of elements in this collection. Returns: the number of elements in this collection
virtual Object::Holder | get (size32_t i) const
  | 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
virtual Object::Holder | set (size32_t i, Object::Holder oh)
  | 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
virtual bool | add (size32_t i, Object::Holder oh)
  | 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
virtual bool | addAll (size32_t i, Collection::View vColl)
  | 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
virtual Object::Holder | remove (size32_t i)
  | 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
virtual size32_t | indexOf (Object::View v) const
  | 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
virtual size32_t | lastIndexOf (Object::View v) const
  | 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
virtual bool | contains (Object::View v) const
  | Determine if this collection contains the specified element. Parameters:
  | v | the element to test for containment
Returns: true iff this collection contains the given element
virtual ObjectArray::Handle | toArray (ObjectArray::Handle ha=NULL) const
  | Return the contents of this collection as an ObjectArray. If the collection fits in the specified array, it is returned, otherwise, a new array is allocated that is the size of this collection. If this collection fits in the array with aditional room then the element in the array immediately following the end of the collection is set to NULL. This can be useful in determining the length of this collection if the caller knows that the collection does not contain any NULL elements. Parameters:
  | hao | an array in which to store the collection's contents
Returns: a ObjectArray containing all the elements of the collection in the same order as returned by the collection's Iterator See also: Iterator
virtual Iterator::Handle | iterator () const
| Return an Iterator over this collection. Returns: an Iterator over this collection
virtual Muterator::Handle | iterator ()
| Return an Iterator over this collection. Returns: an Iterator over this collection
virtual ListIterator::Handle | listIterator (size32_t i=0) const
  | 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
virtual ListMuterator::Handle | listIterator (size32_t i=0)
  | 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
virtual List::View | subList (size32_t iFrom, size32_t iTo) const
  | 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
virtual List::Handle | subList (size32_t iFrom, size32_t iTo)
  | 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
virtual bool | equals (Object::View v) const
## Static Public Member Functions
static size32_t | calculateTotalLength (ObjectArray::View vaao)
| Calculate the total number of element in the array of arrays.
static ObjectArray::Handle | flatten (ObjectArray::View vaaoFrom, size32_t cTotal, ObjectArray::Handle haoTo=NULL)
| Create a single dimensional array containing all elements of the specified array of arrays.
## Protected Member Functions
| ReadOnlyMultiList (ObjectArray::View vaao)
| Construct a List containing the elements of the specified array of Object arrays.
## Static Protected Member Functions
template<class T>
static List::Holder | subList (T, size32_t iFrom, size32_t iTo)
| Common subList method implementation.
## Classes
class | ListView
| ListView exposes the underlying ReadOnlyMultiList through the List interface, maintaining correct equals() and hashCode() semantics. More...
class | SetView
| SetView exposes the underlying ReadOnlyMultiList through the Set interface, maintaining correct equals() and hashCode() semantics. More...

## Constructor & Destructor Documentation

ReadOnlyMultiList | ( | ObjectArray::View | vaao | ) | `[protected]`

Construct a List containing the elements of the specified array of Object arrays.

Parameters:

  | vaao | the array of arrays backing the MultiList

## Member Function Documentation

virtual List::Handle getList | ( |  | ) | `[virtual]`

Return a List view of this ReadOnlyMultiList.

Returns:
  a List view of this ReadOnlyMultiList

virtual List::View getList | ( |  | ) | const `[virtual]`

Return a List view of this ReadOnlyMultiList.

Returns:
  a List view of this ReadOnlyMultiList

virtual Set::Handle getSet | ( |  | ) | `[virtual]`

Return a Set view of this ReadOnlyMultiList.

Returns:
  a Set view of this ReadOnlyMultiList

virtual Set::View getSet | ( |  | ) | const `[virtual]`

Return a Set view of this ReadOnlyMultiList.

Returns:
  a Set view of this ReadOnlyMultiList

static size32_t calculateTotalLength | ( | ObjectArray::View | vaao | ) | `[static]`

Calculate the total number of element in the array of arrays.

Parameters:

  | vaao | an array of arrays

Returns:
  the total number of elements

static ObjectArray::Handle flatten | ( | ObjectArray::View | vaaoFrom,
|  | size32_t | cTotal,
|  | ObjectArray::Handle | haoTo = `NULL` |
| ) |  |  | `[static]`

Create a single dimensional array containing all elements of the specified array of arrays.

Parameters:

  | vaaoFrom | an array of arrays to copy from
  | cTotal | the total length of the flattened array; pass npos for it to be calculated
  | vaoTo | an array to copy the elements into (optional)

Returns:
  an array containing all the elements of the array of arrays

Exceptions:

  | ArrayIndexOutOfBoundsException | if the total length parameter was not sufficient to hold the flattened array

The documentation for this class was generated from the following file:

- coherence/util/ReadOnlyMultiList.hpp

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.