Added in API level 1

AbstractSequentialList

abstract class AbstractSequentialList<E : Any!> : AbstractList<E>
kotlin.Any
   ↳ java.util.AbstractCollection<E>
   ↳ java.util.AbstractList<E>
   ↳ java.util.AbstractSequentialList

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, E element), add(int index, E 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.

Summary

Protected constructors

Sole constructor.

Public methods
open Unit
add(index: Int, element: E)

Inserts the specified element at the specified position in this list (optional operation).

open Boolean
addAll(index: Int, elements: Collection<E>)

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

open E
get(index: Int)

Returns the element at the specified position in this list.

open MutableIterator<E>

Returns an iterator over the elements in this list (in proper sequence).

abstract MutableListIterator<E>
listIterator(index: Int)

Returns a list iterator over the elements in this list (in proper sequence).

open E
removeAt(index: Int)

Removes the element at the specified position in this list (optional operation).

open E
set(index: Int, element: E)

Replaces the element at the specified position in this list with the specified element (optional operation).

Inherited functions
Inherited properties