class CursorableSubList<E> extends CursorableLinkedList<E> implements java.util.List<E>
CursorableLinkedList.Cursor, CursorableLinkedList.Listable<E>, CursorableLinkedList.ListIter
Modifier and Type | Field and Description |
---|---|
protected CursorableLinkedList<E> |
_list
My underlying list
|
protected CursorableLinkedList.Listable<E> |
_post
The element in my underlying list following the last element in my list.
|
protected CursorableLinkedList.Listable<E> |
_pre
The element in my underlying list preceding the first element in my list.
|
_cursors, _head, _modCount, _size
Constructor and Description |
---|
CursorableSubList(CursorableLinkedList<E> list,
int from,
int to) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o)
Appends the specified element to the end of this list.
|
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list.
|
boolean |
addAll(java.util.Collection<? extends E> c)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
Collection 's Iterator . |
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
Inserts all of the elements in the specified collection into this
list at the specified position.
|
boolean |
addFirst(E o)
Inserts the specified element at the beginning of this list.
|
boolean |
addLast(E o)
Inserts the specified element at the end of this list.
|
protected void |
checkForComod()
Test to see if my underlying list has been modified
by some other process.
|
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element.
|
boolean |
containsAll(java.util.Collection<?> c)
Returns true if this list contains all of the elements of the
specified collection.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this list for equality.
|
E |
get(int index)
Returns the element at the specified position in this list.
|
E |
getFirst()
Returns the element at the beginning of this list.
|
E |
getLast()
Returns the element at the end of this list.
|
int |
hashCode()
Returns the hash code value for this list.
|
int |
indexOf(java.lang.Object o)
Returns the index in this list of the first occurrence of the specified
element, or -1 if this list does not contain this element.
|
protected CursorableLinkedList.Listable<E> |
insertListable(CursorableLinkedList.Listable<E> before,
CursorableLinkedList.Listable<E> after,
E value)
Inserts a new value into my
list, after the specified before element, and before the
specified after element
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
java.util.Iterator<E> |
iterator()
Returns a fail-fast iterator.
|
int |
lastIndexOf(java.lang.Object o)
Returns the index in this list of the last occurrence of the specified
element, or -1 if this list does not contain this element.
|
java.util.ListIterator<E> |
listIterator()
Returns a fail-fast ListIterator.
|
java.util.ListIterator<E> |
listIterator(int index)
Returns a fail-fast ListIterator.
|
E |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence in this list of the specified element.
|
boolean |
removeAll(java.util.Collection<?> c)
Removes from this list all the elements that are contained in the
specified collection.
|
E |
removeFirst()
Removes the first element of this list, if any.
|
E |
removeLast()
Removes the last element of this list, if any.
|
protected void |
removeListable(CursorableLinkedList.Listable<E> elt)
Removes the given
CursorableLinkedList.Listable from my list. |
boolean |
retainAll(java.util.Collection<?> c)
Retains only the elements in this list that are contained in the
specified collection.
|
E |
set(int index,
E element)
Replaces the element at the specified position in this list with the
specified element.
|
int |
size()
Returns the number of elements in this list.
|
java.util.List<E> |
subList(int fromIndex,
int toIndex)
Returns a fail-fast sublist.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list in proper
sequence.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this list in proper
sequence; the runtime type of the returned array is that of the
specified array.
|
broadcastListableChanged, broadcastListableInserted, broadcastListableRemoved, cursor, cursor, getListableAt, invalidateCursors, registerCursor, toString, unregisterCursor
protected CursorableLinkedList<E> _list
protected CursorableLinkedList.Listable<E> _pre
protected CursorableLinkedList.Listable<E> _post
CursorableSubList(CursorableLinkedList<E> list, int from, int to)
public void clear()
CursorableLinkedList
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class CursorableLinkedList<E>
public java.util.Iterator<E> iterator()
CursorableLinkedList
public int size()
CursorableLinkedList
size
in interface java.util.Collection<E>
size
in interface java.util.List<E>
size
in class CursorableLinkedList<E>
public boolean isEmpty()
CursorableLinkedList
isEmpty
in interface java.util.Collection<E>
isEmpty
in interface java.util.List<E>
isEmpty
in class CursorableLinkedList<E>
public java.lang.Object[] toArray()
CursorableLinkedList
Collection.toArray()
method.toArray
in interface java.util.Collection<E>
toArray
in interface java.util.List<E>
toArray
in class CursorableLinkedList<E>
public <T> T[] toArray(T[] a)
CursorableLinkedList
Collection.toArray()
method.toArray
in interface java.util.Collection<E>
toArray
in interface java.util.List<E>
toArray
in class CursorableLinkedList<E>
a
- the array into which the elements of this list are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.public boolean contains(java.lang.Object o)
CursorableLinkedList
contains
in interface java.util.Collection<E>
contains
in interface java.util.List<E>
contains
in class CursorableLinkedList<E>
o
- element whose presence in this list is to be tested.public boolean remove(java.lang.Object o)
CursorableLinkedList
remove
in interface java.util.Collection<E>
remove
in interface java.util.List<E>
remove
in class CursorableLinkedList<E>
o
- element to be removed from this list, if present.public E removeFirst()
CursorableLinkedList
removeFirst
in class CursorableLinkedList<E>
public E removeLast()
CursorableLinkedList
removeLast
in class CursorableLinkedList<E>
public boolean addAll(java.util.Collection<? extends E> c)
CursorableLinkedList
Collection
's Iterator
. The behavior of this operation is
unspecified if the specified collection is modified while
the operation is in progress. (Note that this will occur if the
specified collection is this list, and it's nonempty.)addAll
in interface java.util.Collection<E>
addAll
in interface java.util.List<E>
addAll
in class CursorableLinkedList<E>
c
- collection whose elements are to be added to this list.public boolean add(E o)
CursorableLinkedList
add
in interface java.util.Collection<E>
add
in interface java.util.List<E>
add
in class CursorableLinkedList<E>
o
- element to be appended to this list.public boolean addFirst(E o)
CursorableLinkedList
add(0,o)
).addFirst
in class CursorableLinkedList<E>
o
- element to be prepended to this list.public boolean addLast(E o)
CursorableLinkedList
CursorableLinkedList.add(java.lang.Object)
).addLast
in class CursorableLinkedList<E>
o
- element to be appended to this list.public boolean removeAll(java.util.Collection<?> c)
CursorableLinkedList
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class CursorableLinkedList<E>
c
- collection that defines which elements will be removed from
this list.public boolean containsAll(java.util.Collection<?> c)
CursorableLinkedList
containsAll
in interface java.util.Collection<E>
containsAll
in interface java.util.List<E>
containsAll
in class CursorableLinkedList<E>
c
- collection to be checked for containment in this list.public boolean addAll(int index, java.util.Collection<? extends E> c)
CursorableLinkedList
Collection
's Iterator
. The behavior of this operation is
unspecified if the specified collection is modified while the
operation is in progress. (Note that this will occur if the specified
collection is this list, and it's nonempty.)addAll
in interface java.util.List<E>
addAll
in class CursorableLinkedList<E>
index
- index at which to insert first element from the specified
collection.c
- elements to be inserted into this list.public int hashCode()
CursorableLinkedList
hashCode = 1; Iterator i = list.iterator(); while (i.hasNext()) { Object obj = i.next(); hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode()); }This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object.hashCode.
hashCode
in interface java.util.Collection<E>
hashCode
in interface java.util.List<E>
hashCode
in class CursorableLinkedList<E>
Object.hashCode()
,
Object.equals(Object)
,
CursorableLinkedList.equals(Object)
public boolean retainAll(java.util.Collection<?> c)
CursorableLinkedList
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.List<E>
retainAll
in class CursorableLinkedList<E>
c
- collection that defines which elements this set will retain.public E set(int index, E element)
CursorableLinkedList
set
in interface java.util.List<E>
set
in class CursorableLinkedList<E>
index
- index of element to replace.element
- element to be stored at the specified position.public boolean equals(java.lang.Object o)
CursorableLinkedList
equals
in interface java.util.Collection<E>
equals
in interface java.util.List<E>
equals
in class CursorableLinkedList<E>
o
- the object to be compared for equality with this list.public E get(int index)
CursorableLinkedList
get
in interface java.util.List<E>
get
in class CursorableLinkedList<E>
index
- index of element to return.public E getFirst()
CursorableLinkedList
getFirst
in class CursorableLinkedList<E>
public E getLast()
CursorableLinkedList
getLast
in class CursorableLinkedList<E>
public void add(int index, E element)
CursorableLinkedList
add
in interface java.util.List<E>
add
in class CursorableLinkedList<E>
index
- index at which the specified element is to be inserted.element
- element to be inserted.public java.util.ListIterator<E> listIterator(int index)
CursorableLinkedList
listIterator
in interface java.util.List<E>
listIterator
in class CursorableLinkedList<E>
List.listIterator(int)
public E remove(int index)
CursorableLinkedList
remove
in interface java.util.List<E>
remove
in class CursorableLinkedList<E>
index
- the index of the element to removed.public int indexOf(java.lang.Object o)
CursorableLinkedList
indexOf
in interface java.util.List<E>
indexOf
in class CursorableLinkedList<E>
o
- element to search for.public int lastIndexOf(java.lang.Object o)
CursorableLinkedList
lastIndexOf
in interface java.util.List<E>
lastIndexOf
in class CursorableLinkedList<E>
o
- element to search for.public java.util.ListIterator<E> listIterator()
CursorableLinkedList
listIterator
in interface java.util.List<E>
listIterator
in class CursorableLinkedList<E>
List.listIterator()
public java.util.List<E> subList(int fromIndex, int toIndex)
CursorableLinkedList
subList
in interface java.util.List<E>
subList
in class CursorableLinkedList<E>
List.subList(int,int)
protected CursorableLinkedList.Listable<E> insertListable(CursorableLinkedList.Listable<E> before, CursorableLinkedList.Listable<E> after, E value)
insertListable
in class CursorableLinkedList<E>
CursorableLinkedList.Listable
protected void removeListable(CursorableLinkedList.Listable<E> elt)
CursorableLinkedList.Listable
from my list.removeListable
in class CursorableLinkedList<E>
protected void checkForComod() throws java.util.ConcurrentModificationException
ConcurrentModificationException
, otherwise
quietly returns.java.util.ConcurrentModificationException