Moyosoft Products | Services | Download | Contact us    
JavaDocPlus
Products  >  JavaDocPlus  >  Online demo    


Latest release




Get a FREE license !
(Special offer, time limited)

Review JavaDocPlus on your blog and we'll give you a free license.

Open source projects licenced under LGPL, EPL, ASL, BSD or MIT can also obtain a free license.

Contact us to check if your project/blog is eligible.

Online demo
JavaDocPlus Demo  |  Show in full page mode
   
Overview  |  
Classic JavaDoc

Class AbstractSequentialList

java.lang.Objectjava.util.AbstractCollectionjava.util.AbstractListjava.util.AbstractSequentialList

Direct Known Subclasses:

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 the AbstractList class 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 the list's list iterator, 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 list iterator's hasNext, next, hasPrevious, previous and index methods.

For a modifiable list the programmer should additionally implement the list iterator's set method. For a variable-size list the programmer should additionally implement the list iterator'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.

This class is a member of the Java Collections Framework.

Author:
Josh BlochNeal Gafter

Version:
1.33, 02/19/04

See Also:
Collection, List, AbstractList, AbstractCollection

Since:
1.2

Constructors

protected
AbstractSequentialList ()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Methods

void
add (int index, 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 list iterator pointing to the indexed element (with list ... more >
boolean
addAll (int index, Collection c)
Inserts all of the elements 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 ... more >
get (int index)
Returns the element at the specified position in this list. This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it gets the element using ListIterator.next and returns it.
iterator ()
Returns an iterator over the elements in this list (in proper sequence). This implementation merely returns a list iterator over the list.
abstract ListIterator
listIterator (int index)
Returns a list iterator over the elements in this list (in proper sequence).
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). This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it removes the element with Li ... more >
set (int index, Object element)
Replaces the element at the specified position in this list with the specified element. This implementation first gets a list iterator pointing to the indexed element (with listIterator(index)). Then, it gets the current element using ListIterator.next and replaces it with ListIte ... more >

Inherited methods

Community comments



Powered by JavaDocPlus