public final class UnmodifiableCollectionImpl<E> extends MutableList<E> implements java.util.List<E>, Reusable
FastCollection.Record| Constructor and Description |
|---|
UnmodifiableCollectionImpl(MutableList<E> inner) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element)
Appends the specified value to the end of this collection
(optional operation).
|
void |
add(int index,
E element) |
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.
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
void |
clear()
Removes all of the values from this collection (optional operation).
|
boolean |
contains(java.lang.Object value)
Indicates if this collection contains the specified value.
|
boolean |
containsAll(java.util.Collection<?> c)
Indicates if this collection contains all of the values of the
specified collection.
|
void |
delete(FastCollection.Record record)
Deletes the specified record from this collection.
|
E |
get(int index) |
FastCollection.Record |
head()
Returns the head record of this collection; it is the record such as
head().getNext() holds the first collection value. |
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty()
Indicates if this collection is empty.
|
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this collection
(allocated on the stack when executed in a
StackContext). |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(java.lang.Object value)
Removes the first occurrence in this collection of the specified value
(optional operation).
|
boolean |
removeAll(java.util.Collection<?> c)
Removes from this collection all the values that are contained in the
specified collection.
|
void |
reset()
Resets the internal state of this object to its default values.
|
boolean |
retainAll(java.util.Collection<?> c)
Retains only the values in this collection that are contained in the
specified collection.
|
E |
set(int index,
E element) |
int |
size()
Returns the number of values in this collection.
|
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
FastCollection.Record |
tail()
Returns the tail record of this collection; it is the record such as
tail().getPrevious() holds the last collection value. |
java.lang.Object[] |
toArray()
Returns a new array allocated on the heap containing all of the values
in this collection in proper sequence.
|
<T> T[] |
toArray(T[] array)
Fills the specified array with the values of this collection in
the proper sequence.
|
E |
valueOf(FastCollection.Record record)
Returns the collection value for the specified record.
|
shared, unmodifiableequals, getValueComparator, hashCode, toString, toTextpublic UnmodifiableCollectionImpl(MutableList<E> inner)
public boolean add(E element)
FastCollectionNote: This default implementation always throws
UnsupportedOperationException.
add in interface java.util.Collection<E>add in interface java.util.List<E>add in class MutableList<E>element - the value to be appended to this collection.true (as per the general contract of the
Collection.add method).public void add(int index,
E element)
add in interface java.util.List<E>add in class MutableList<E>public boolean addAll(java.util.Collection<? extends E> c)
FastCollectionaddAll in interface java.util.Collection<E>addAll in interface java.util.List<E>addAll in class MutableList<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 boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E>addAll in class MutableList<E>public void clear()
FastCollectionclear in interface java.util.Collection<E>clear in interface java.util.List<E>clear in class MutableList<E>public boolean contains(java.lang.Object value)
FastCollectioncontains in interface java.util.Collection<E>contains in interface java.util.List<E>contains in class MutableList<E>value - the value whose presence in this collection
is to be tested.true if this collection contains the specified
value;false otherwise.public boolean containsAll(java.util.Collection<?> c)
FastCollectioncontainsAll in interface java.util.Collection<E>containsAll in interface java.util.List<E>containsAll in class FastCollection<E>c - collection to be checked for containment in this collection.true if this collection contains all of the values
of the specified collection; false otherwise.public void delete(FastCollection.Record record)
FastCollectionImplementation 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 MutableList<E>record - the record to be removed.public E get(int index)
get in interface java.util.List<E>get in class MutableList<E>public FastCollection.Record head()
FastCollectionhead().getNext() holds the first collection value.head in class MutableList<E>public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<E>indexOf in class MutableList<E>public boolean isEmpty()
FastCollectionisEmpty in interface java.util.Collection<E>isEmpty in interface java.util.List<E>isEmpty in class MutableList<E>true if this collection contains no value;
false otherwise.public java.util.Iterator<E> iterator()
FastCollectionStackContext).public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<E>lastIndexOf in class MutableList<E>public java.util.ListIterator<E> listIterator()
listIterator in interface java.util.List<E>listIterator in class MutableList<E>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E>listIterator in class MutableList<E>public E remove(int index)
remove in interface java.util.List<E>remove in class MutableList<E>public boolean remove(java.lang.Object value)
FastCollectionremove in interface java.util.Collection<E>remove in interface java.util.List<E>remove in class MutableList<E>value - the value to be removed from this collection.true if this collection contained the specified
value; false otherwise.public boolean removeAll(java.util.Collection<?> c)
FastCollectionremoveAll in interface java.util.Collection<E>removeAll in interface java.util.List<E>removeAll in class FastCollection<E>c - collection that defines which values will be removed from
this collection.true if this collection changed as a result of
the call; false otherwise.public void reset()
Reusablepublic boolean retainAll(java.util.Collection<?> c)
FastCollectionretainAll in interface java.util.Collection<E>retainAll in interface java.util.List<E>retainAll in class FastCollection<E>c - collection that defines which values this set will retain.true if this collection changed as a result of
the call; false otherwise.public E set(int index, E element)
set in interface java.util.List<E>set in class MutableList<E>public int size()
FastCollectionsize in interface java.util.Collection<E>size in interface java.util.List<E>size in class MutableList<E>public java.util.List<E> subList(int fromIndex, int toIndex)
subList in interface java.util.List<E>subList in class MutableList<E>public FastCollection.Record tail()
FastCollectiontail().getPrevious() holds the last collection value.tail in class MutableList<E>public java.lang.Object[] toArray()
FastCollection Note: To avoid heap allocation FastCollection.toArray(Object[]) is
recommended.
toArray in interface java.util.Collection<E>toArray in interface java.util.List<E>toArray in class FastCollection<E>toArray(new Object[size()])public <T> T[] toArray(T[] array)
FastCollectionNote: Unlike standard Collection, this method does not try to resize the array using reflection (which might not be supported) if the array is too small. UnsupportedOperationException is raised if the specified array is too small for this collection.
toArray in interface java.util.Collection<E>toArray in interface java.util.List<E>toArray in class FastCollection<E>array - the array into which the values of this collection
are to be stored.public E valueOf(FastCollection.Record record)
FastCollectionvalueOf in class MutableList<E>record - the record whose current value is returned.Copyright © 2005 - 2007 Javolution.