public abstract class MutableList<E> extends FastCollection<E> implements java.util.List<E>, Reusable
FastCollection.Record
Constructor and Description |
---|
MutableList() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
add(E o)
Appends the specified value to the end of this collection
(optional operation).
|
abstract void |
add(int index,
E element) |
abstract boolean |
addAll(java.util.Collection<? extends E> c)
Appends all of the values in the specified collection to the end of
this collection, in the order that they are returned by the specified
collection's iterator.
|
abstract boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
abstract void |
clear()
Removes all of the values from this collection (optional operation).
|
abstract boolean |
contains(java.lang.Object o)
Indicates if this collection contains the specified value.
|
abstract void |
delete(FastCollection.Record record)
Deletes the specified record from this collection.
|
abstract E |
get(int index) |
abstract FastCollection.Record |
head()
Returns the head record of this collection; it is the record such as
head().getNext() holds the first collection value. |
abstract int |
indexOf(java.lang.Object o) |
abstract boolean |
isEmpty()
Indicates if this collection is empty.
|
abstract java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this collection
(allocated on the stack when executed in a
StackContext ). |
abstract int |
lastIndexOf(java.lang.Object o) |
abstract java.util.ListIterator<E> |
listIterator() |
abstract java.util.ListIterator<E> |
listIterator(int index) |
abstract E |
remove(int index) |
abstract boolean |
remove(java.lang.Object o)
Removes the first occurrence in this collection of the specified value
(optional operation).
|
abstract E |
set(int index,
E element) |
MutableList<E> |
shared()
Returns a thread-safe read-write view of this collection.
|
abstract int |
size()
Returns the number of values in this collection.
|
abstract java.util.List<E> |
subList(int fromIndex,
int toIndex) |
abstract FastCollection.Record |
tail()
Returns the tail record of this collection; it is the record such as
tail().getPrevious() holds the last collection value. |
MutableList<E> |
unmodifiable()
Returns the unmodifiable view associated to this collection.
|
abstract E |
valueOf(FastCollection.Record record)
Returns the collection value for the specified record.
|
containsAll, equals, getValueComparator, hashCode, removeAll, retainAll, toArray, toArray, toString, toText
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public MutableList<E> unmodifiable()
FastCollection
UnsupportedOperationException
being thrown.unmodifiable
in class FastCollection<E>
public MutableList<E> shared()
FastCollection
Returns a thread-safe read-write view of this collection.
The default implementation performs synchronization on read and write. Sub-classes may provide more efficient implementation (e.g. only synchronizing on writes modifying the internal data structure).
Having a shared collection does not mean that modifications made by onethread are automatically viewed by others thread. Which in practice is not an issue. In a well-behaved system, threads need to synchronize only at predetermined synchronization points (the fewer the better).
shared
in class FastCollection<E>
public abstract int size()
FastCollection
size
in interface java.util.Collection<E>
size
in interface java.util.List<E>
size
in class FastCollection<E>
public abstract boolean isEmpty()
FastCollection
isEmpty
in interface java.util.Collection<E>
isEmpty
in interface java.util.List<E>
isEmpty
in class FastCollection<E>
true
if this collection contains no value;
false
otherwise.public abstract boolean contains(java.lang.Object o)
FastCollection
contains
in interface java.util.Collection<E>
contains
in interface java.util.List<E>
contains
in class FastCollection<E>
o
- the value whose presence in this collection
is to be tested.true
if this collection contains the specified
value;false
otherwise.public abstract java.util.Iterator<E> iterator()
FastCollection
StackContext
).public abstract boolean add(E o)
FastCollection
Note: This default implementation always throws
UnsupportedOperationException
.
add
in interface java.util.Collection<E>
add
in interface java.util.List<E>
add
in class FastCollection<E>
o
- the value to be appended to this collection.true
(as per the general contract of the
Collection.add
method).public abstract boolean remove(java.lang.Object o)
FastCollection
remove
in interface java.util.Collection<E>
remove
in interface java.util.List<E>
remove
in class FastCollection<E>
o
- the value to be removed from this collection.true
if this collection contained the specified
value; false
otherwise.public abstract boolean addAll(java.util.Collection<? extends E> c)
FastCollection
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.List<E>
addAll
in class FastCollection<E>
c
- collection whose values are to be added to this collection.true
if this collection changed as a result of
the call; false
otherwise.public abstract boolean addAll(int index, java.util.Collection<? extends E> c)
addAll
in interface java.util.List<E>
public abstract void clear()
FastCollection
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class FastCollection<E>
public abstract int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<E>
public abstract int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<E>
public abstract java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public abstract java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
public abstract java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
public abstract FastCollection.Record head()
FastCollection
head().getNext()
holds the first collection value.head
in class FastCollection<E>
public abstract FastCollection.Record tail()
FastCollection
tail().getPrevious()
holds the last collection value.tail
in class FastCollection<E>
public abstract E valueOf(FastCollection.Record record)
FastCollection
valueOf
in class FastCollection<E>
record
- the record whose current value is returned.public abstract void delete(FastCollection.Record record)
FastCollection
Implementation must ensure that removing a record from the collection does not affect in any way the records preceding the record being removed (it might affect the next records though, e.g. in a list collection, the indices of the subsequent records will change).
delete
in class FastCollection<E>
record
- the record to be removed.Copyright © 2005 - 2007 Javolution.