Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo.server.java.util
Class AbstractSequentialList

`java.lang.Object
oracle.jbo.server.java.util.AbstractCollection
oracle.jbo.server.java.util.AbstractList
oracle.jbo.server.java.util.AbstractSequentialList`

All Implemented Interfaces:
  Collection, List

public abstract class AbstractSequentialList
extends AbstractList

This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "sequential access" data store (such as a linked list). For random access data (such as an array), AbstractList should be used in preference to this Class.

This class is the opposite of AbstractList in the sense that it implements the "random access" methods (get(int index), set(int index, Object element), set(int index, Object element), add(int index, Object element) and remove(int index)) on top of List's listIterator, instead of the other way around.

To implement a List the programmer needs only to extend this class and provide implementations for the listIterator and size methods. For an unmodifiable List, the programmer need only implement the listIterator's hasNext, next, hasPrevious, previous and index methods.

For a modifiable List the programmer should additionally implement the listIterator's set method. For a variable-size list the programmer should additionally implement the listIterator's remove and add methods.

The programmer should generally provide a void (no argument) and Collection constructor, as per the recommendation in the Collection interface specification.

Since:
  JDK1.2
See Also:
  `Collection`, `List`, `AbstractList`, `AbstractCollection`

Field Summary

Fields inherited from class oracle.jbo.server.java.util.AbstractList
`modCount`

Constructor Summary
`AbstractSequentialList()`

Method Summary
`void` | `add(int index, java.lang.Object element)` Inserts the specified element at the specified position in this List.
`boolean` | `addAll(int index, Collection c)` Inserts all of the elements in in the specified Collection into this List at the specified position.
`java.lang.Object` | `get(int index)` Returns the element at the specified position in this List.
`abstract ListIterator` | `listIterator(int index)` Returns a ListIterator of the elements in this List (in proper sequence).
`java.lang.Object` | `remove(int index)` Removes the element at the specified position in this List.
`void` | `removeRange(int fromIndex, int toIndex)` Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
`java.lang.Object` | `set(int index, java.lang.Object element)` Replaces the element at the specified position in this List with the specified element.

Methods inherited from class oracle.jbo.server.java.util.AbstractList
`add, equals, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator`

Methods inherited from class oracle.jbo.server.java.util.AbstractCollection
`addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface oracle.jbo.server.java.util.List
`addAll, clear, contains, containsAll, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray`

Constructor Detail

### AbstractSequentialList

    public AbstractSequentialList()

Method Detail

### get

    public java.lang.Object get(int index)

  Returns the element at the specified position in this List.

  This implementation first gets a ListIterator pointing to the indexed element (with listIterator(index)). Then, it gets the element using ListIterator.next and returns it.

  Specified by:
    `get` in interface `List`
  Specified by:
    `get` in class `AbstractList`
  Parameters:
    `index` - index of element to return.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - index is out of range (index < 0 || index >= size()).
  Since:
    JDK1.2

### set

    public java.lang.Object set(int index,
                                java.lang.Object element)

  Replaces the element at the specified position in this List with the specified element.

  This implementation first gets a ListIterator pointing to the indexed element (with listIterator(index)). Then, it gets the current element using ListIterator.next and replaces it with ListIterator.set.

  Note that this implementation will throw an UnsupportedOperationException if listIterator does not implement the set operation.

  Specified by:
    `set` in interface `List`
  Overrides:
    `set` in class `AbstractList`
  Parameters:
    `index` - index of element to replace.
    `element` - element to be stored at the specified position.
  Returns:
    the element previously at the specified position.
  Throws:
    `UnsupportedOperationException` - set is not supported by this List.
    `java.lang.NullPointerException` - this List does not permit null elements and one of the elements of `c` is null.
    `java.lang.ClassCastException` - class of the specified element prevents it from being added to this List.
    `java.lang.IllegalArgumentException` - some aspect of the specified element prevents it from being added to this List.
    `java.lang.ArrayIndexOutOfBoundsException` - index out of range (index < 0 || index >= size()).
    `java.lang.IllegalArgumentException` - fromIndex > toIndex.
  Since:
    JDK1.2

### add

    public void add(int index,
                    java.lang.Object element)

  Inserts the specified element at the specified position in this List. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

  This implementation first gets a ListIterator pointing to the indexed element (with listIterator(index)). Then, it inserts the specified element with ListIterator.add.

  Note that this implementation will throw an UnsupportedOperationException if listIterator does not implement the add operation.

  Specified by:
    `add` in interface `List`
  Overrides:
    `add` in class `AbstractList`
  Parameters:
    `index` - index at which the specified element is to be inserted.
    `element` - element to be inserted.
  Throws:
    `UnsupportedOperationException` - add is not supported by this List.
    `java.lang.NullPointerException` - this List does not permit null elements and one of the elements of `c` is null.
    `java.lang.ClassCastException` - class of the specified element prevents it from being added to this List.
    `java.lang.IllegalArgumentException` - some aspect of the specified element prevents it from being added to this List.
    `java.lang.ArrayIndexOutOfBoundsException` - index is out of range (index < 0 || index > size()).
  Since:
    JDK1.2

### remove

    public java.lang.Object remove(int index)

  Removes the element at the specified position in this List. shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the List.

  This implementation first gets a ListIterator pointing to the indexed element (with listIterator(index)). Then, it removes the element with ListIterator.remove.

  Note that this implementation will throw an UnsupportedOperationException if listIterator does not implement the remove operation.

  Specified by:
    `remove` in interface `List`
  Overrides:
    `remove` in class `AbstractList`
  Parameters:
    `index` - the index of the element to removed.
  Returns:
    the element previously at the specified position.
  Throws:
    `UnsupportedOperationException` - remove is not supported by this List.
    `java.lang.ArrayIndexOutOfBoundsException` - index out of range (index < 0 || index >= size()).
  Since:
    JDK1.2

### removeRange

    public void removeRange(int fromIndex,
                            int toIndex)

  Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the List by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)

  This implementation first checks to see that the indices are in range. Then, it gets a ListIterator pointing to the element at the beginning of the range (with listIterator(index)). Finally, it iterates over the range, calling ListIterator's remove operation for each element to be removed.

  Note that this implementation will throw an UnsupportedOperationException if listIterator does not implement the remove operation.

  Specified by:
    `removeRange` in interface `List`
  Overrides:
    `removeRange` in class `AbstractList`
  Parameters:
    `fromIndex` - index of first element to be removed.
    `toIndex` - index after last element to be removed.
  Throws:
    `UnsupportedOperationException` - removeRange is not supported by this List.
    `java.lang.ArrayIndexOutOfBoundsException` - fromIndex or toIndex out of range (fromIndex < 0 || fromIndex >= size() || toIndex > size() || toIndex < fromIndex).
  Since:
    JDK1.2

### addAll

    public boolean addAll(int index,
                          Collection c)

  Inserts all of the elements in in the specified Collection into this List at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the List in the order that they are returned by the specified Collection's iterator. The behavior of this operation is unspecified if the specified Collection is modified while the operation is in progress. (Note that this will occur if the specified Collection is this List, and it's nonempty.) Optional operation.

  This implementation gets an Iterator over the specified Collection and a ListIterator over this List pointing to the indexed element (with listIterator(index)). Then, it iterates over the specified Collection, inserting the elements obtained from the Iterator into this List, one at a time, using ListIterator.add followed by ListIterator.next (to skip over the added element).

  Note that this implementation will throw an UnsupportedOperationException if the ListIterator returned by listIterator does not implement the add operation.

  Specified by:
    `addAll` in interface `List`
  Overrides:
    `addAll` in class `AbstractList`
  Parameters:
    `index` - index at which to insert first element from the specified collection.
    `c` - elements to be inserted into this List.
  Returns:
    true if this List changed as a result of the call.
  Throws:
    `UnsupportedOperationException` - addAll is not supported by this List.
    `java.lang.NullPointerException` - this List does not permit null elements and one of the elements of `c` is null.
    `java.lang.ClassCastException` - class of the specified element prevents it from being added to this List.
    `java.lang.IllegalArgumentException` - some aspect of the specified element prevents it from being added to this List.
    `java.lang.ArrayIndexOutOfBoundsException` - index out of range (index < 0 || index > size()).
  Since:
    JDK1.2

### listIterator

    public abstract ListIterator listIterator(int index)

  Returns a ListIterator of the elements in this List (in proper sequence).
  Specified by:
    `listIterator` in interface `List`
  Overrides:
    `listIterator` in class `AbstractList`
  Parameters:
    `index` - index of first element to be returned from the ListIterator (by a call to getNext).
  Since:
    JDK1.2
  See Also:
    `AbstractList.modCount`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1997, 2005, Oracle. All rights reserved.