Class AbstractSequentialList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
- All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>
- Direct Known Subclasses:
LinkedList
AbstractSequentialList is an abstract implementation of the List interface.
This implementation does not support adding. A subclass must implement the
abstract method listIterator().
- Since:
- 1.2
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new instance of this AbstractSequentialList. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified object into this List at the specified location.booleanaddAll(int location, Collection<? extends E> collection) Inserts the objects in the specified Collection at the specified location in this List.get(int location) Returns the element at the specified location in this list.iterator()Returns an iterator on the elements of this list.abstract ListIterator<E> listIterator(int location) Returns a list iterator on the elements of this list.remove(int location) Removes the object at the specified location from this list.Replaces the element at the specified location in this list with the specified object.Methods inherited from class AbstractList
add, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList, toArray, toArrayModifier and TypeMethodDescriptionbooleanAdds the specified object at the end of this List.voidclear()Removes all elements from this list, leaving it empty.booleanCompares the specified object to this list and return true if they are equal.inthashCode()Returns the hash code of this list.intSearches this list for the specified object and returns the index of the first occurrence.intlastIndexOf(Object object) Searches this list for the specified object and returns the index of the last occurrence.Returns a ListIterator on the elements of this list.protected voidremoveRange(int start, int end) Removes the objects in the specified range from the start to the end index minus one.subList(int start, int end) Returns a part of consecutive elements of this list as a view.Object[]toArray()Returns a new array containing all elements contained in thisArrayList.<T> T[]toArray(T[] contents) Returns an array containing all elements contained in thisArrayList.Methods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toStringModifier and TypeMethodDescriptionbooleanaddAll(Collection<? extends E> collection) Attempts to add all of the objects contained incollectionto the contents of thisCollection(optional).booleanTests whether thisCollectioncontains the specified object.booleancontainsAll(Collection<?> collection) Tests whether thisCollectioncontains all objects contained in the specifiedCollection.booleanisEmpty()Returns if thisCollectioncontains no elements.booleanRemoves one instance of the specified object from thisCollectionif one is contained (optional).booleanremoveAll(Collection<?> collection) Removes all occurrences in thisCollectionof each object in the specifiedCollection(optional).booleanretainAll(Collection<?> collection) Removes all objects from thisCollectionthat are not also found in theCollectionpassed (optional).abstract intsize()Returns a count of how many objects thisCollectioncontains.toString()Returns the string representation of thisCollection.Methods inherited from class Object
clone, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()final ClassgetClass()Returns the runtime class of an object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.Methods inherited from interface List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, sizeModifier and TypeMethodDescriptionbooleanaddAll(Collection<? extends E> collection) Adds the objects in the specified collection to the end of thisList.booleanTests whether thisListcontains the specified object.booleancontainsAll(Collection<?> collection) Tests whether thisListcontains all objects contained in the specified collection.booleanisEmpty()Returns whether thisListcontains no elements.booleanRemoves the first occurrence of the specified object from thisList.booleanremoveAll(Collection<?> collection) Removes all occurrences in thisListof each object in the specified collection.booleanretainAll(Collection<?> collection) Removes all objects from thisListthat are not contained in the specified collection.intsize()Returns the number of elements in thisList.
-
Constructor Details
-
AbstractSequentialList
protected AbstractSequentialList()Constructs a new instance of this AbstractSequentialList.
-
-
Method Details
-
add
Description copied from class:AbstractListInserts the specified object into this List at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this List, the object is added at the end.Concrete implementations that would like to support the add functionality must override this method.
-
addAll
Description copied from class:AbstractListInserts the objects in the specified Collection at the specified location in this List. The objects are added in the order they are returned from the collection's iterator. -
get
Description copied from class:AbstractListReturns the element at the specified location in this list. -
iterator
Description copied from class:AbstractListReturns an iterator on the elements of this list. The elements are iterated in the same order as they occur in the list. -
listIterator
Description copied from class:AbstractListReturns a list iterator on the elements of this list. The elements are iterated in the same order as they occur in the list. The iteration starts at the specified location.- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classAbstractList<E>- Parameters:
location- the index at which to start the iteration.- Returns:
- a ListIterator on the elements of this list.
- See Also:
-
remove
Description copied from class:AbstractListRemoves the object at the specified location from this list. -
set
Description copied from class:AbstractListReplaces the element at the specified location in this list with the specified object.
-