Package org.apache.commons.collections
Class CursorableSubList
java.lang.Object
org.apache.commons.collections.CursorableLinkedList
org.apache.commons.collections.CursorableSubList
- All Implemented Interfaces:
Serializable,Iterable,Collection,List
Deprecated.
Use new version in list subpackage, which has been rewritten
and now returns the cursor from the listIterator method. Will be removed in v4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.collections.CursorableLinkedList
CursorableLinkedList.Cursor, CursorableLinkedList.Listable, CursorableLinkedList.ListIter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CursorableLinkedListDeprecated.My underlying listprotected CursorableLinkedList.ListableDeprecated.The element in my underlying list following the last element in my list.protected CursorableLinkedList.ListableDeprecated.The element in my underlying list preceding the first element in my list.Fields inherited from class org.apache.commons.collections.CursorableLinkedList
_cursors, _head, _modCount, _size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Inserts the specified element at the specified position in this list.booleanDeprecated.Appends the specified element to the end of this list.booleanaddAll(int index, Collection c) Deprecated.Inserts all of the elements in the specified collection into this list at the specified position.booleanaddAll(Collection c) Deprecated.Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specifiedCollection'sIterator.booleanDeprecated.Inserts the specified element at the beginning of this list.booleanDeprecated.Inserts the specified element at the end of this list.protected voidDeprecated.Test to see if my underlying list has been modified by some other process.voidclear()Deprecated.Removes all of the elements from this list.booleanDeprecated.Returns true if this list contains the specified element.booleanDeprecated.Returns true if this list contains all of the elements of the specified collection.booleanDeprecated.Compares the specified object with this list for equality.get(int index) Deprecated.Returns the element at the specified position in this list.getFirst()Deprecated.Returns the element at the beginning of this list.getLast()Deprecated.Returns the element at the end of this list.inthashCode()Deprecated.Returns the hash code value for this list.intDeprecated.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.ListableinsertListable(CursorableLinkedList.Listable before, CursorableLinkedList.Listable after, Object value) Deprecated.Inserts a new value into my list, after the specified before element, and before the specified after elementbooleanisEmpty()Deprecated.Returns true if this list contains no elements.iterator()Deprecated.Returns a fail-fast iterator.intDeprecated.Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.Deprecated.Returns a fail-fast ListIterator.listIterator(int index) Deprecated.Returns a fail-fast ListIterator.remove(int index) Deprecated.Removes the element at the specified position in this list (optional operation).booleanDeprecated.Removes the first occurrence in this list of the specified element.booleanDeprecated.Removes from this list all the elements that are contained in the specified collection.Deprecated.Removes the first element of this list, if any.Deprecated.Removes the last element of this list, if any.protected voidDeprecated.Removes the givenCursorableLinkedList.Listablefrom my list.booleanDeprecated.Retains only the elements in this list that are contained in the specified collection.Deprecated.Replaces the element at the specified position in this list with the specified element.intsize()Deprecated.Returns the number of elements in this list.subList(int fromIndex, int toIndex) Deprecated.Returns a fail-fast sublist.Object[]toArray()Deprecated.Returns an array containing all of the elements in this list in proper sequence.Object[]Deprecated.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.Methods inherited from class org.apache.commons.collections.CursorableLinkedList
broadcastListableChanged, broadcastListableInserted, broadcastListableRemoved, cursor, cursor, getListableAt, invalidateCursors, registerCursor, toString, unregisterCursorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Field Details
-
_list
Deprecated.My underlying list -
_pre
Deprecated.The element in my underlying list preceding the first element in my list. -
_post
Deprecated.The element in my underlying list following the last element in my list.
-
-
Constructor Details
-
CursorableSubList
CursorableSubList(CursorableLinkedList list, int from, int to) Deprecated.
-
-
Method Details
-
clear
public void clear()Deprecated.Description copied from class:CursorableLinkedListRemoves all of the elements from this list. This list will be empty after this call returns (unless it throws an exception).- Specified by:
clearin interfaceCollection- Specified by:
clearin interfaceList- Overrides:
clearin classCursorableLinkedList
-
iterator
Deprecated.Description copied from class:CursorableLinkedListReturns a fail-fast iterator.- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Specified by:
iteratorin interfaceList- Overrides:
iteratorin classCursorableLinkedList- See Also:
-
size
public int size()Deprecated.Description copied from class:CursorableLinkedListReturns the number of elements in this list.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceList- Overrides:
sizein classCursorableLinkedList- Returns:
- the number of elements in this list.
-
isEmpty
public boolean isEmpty()Deprecated.Description copied from class:CursorableLinkedListReturns true if this list contains no elements.- Specified by:
isEmptyin interfaceCollection- Specified by:
isEmptyin interfaceList- Overrides:
isEmptyin classCursorableLinkedList- Returns:
- true if this list contains no elements.
-
toArray
Deprecated.Description copied from class:CursorableLinkedListReturns an array containing all of the elements in this list in proper sequence. Obeys the general contract of theCollection.toArray()method.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceList- Overrides:
toArrayin classCursorableLinkedList- Returns:
- an array containing all of the elements in this list in proper sequence.
-
toArray
Deprecated.Description copied from class:CursorableLinkedListReturns 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. Obeys the general contract of theCollection.toArray()method.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceList- Overrides:
toArrayin classCursorableLinkedList- Parameters:
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.- Returns:
- an array containing the elements of this list.
-
contains
Deprecated.Description copied from class:CursorableLinkedListReturns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).- Specified by:
containsin interfaceCollection- Specified by:
containsin interfaceList- Overrides:
containsin classCursorableLinkedList- Parameters:
o- element whose presence in this list is to be tested.- Returns:
- true if this list contains the specified element.
-
remove
Deprecated.Description copied from class:CursorableLinkedListRemoves the first occurrence in this list of the specified element. If this list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists).- Specified by:
removein interfaceCollection- Specified by:
removein interfaceList- Overrides:
removein classCursorableLinkedList- Parameters:
o- element to be removed from this list, if present.- Returns:
- true if this list contained the specified element.
-
removeFirst
Deprecated.Description copied from class:CursorableLinkedListRemoves the first element of this list, if any.- Overrides:
removeFirstin classCursorableLinkedList
-
removeLast
Deprecated.Description copied from class:CursorableLinkedListRemoves the last element of this list, if any.- Overrides:
removeLastin classCursorableLinkedList
-
addAll
Deprecated.Description copied from class:CursorableLinkedListAppends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specifiedCollection'sIterator. 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.)- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceList- Overrides:
addAllin classCursorableLinkedList- Parameters:
c- collection whose elements are to be added to this list.- Returns:
- true if this list changed as a result of the call.
-
add
Deprecated.Description copied from class:CursorableLinkedListAppends the specified element to the end of this list.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceList- Overrides:
addin classCursorableLinkedList- Parameters:
o- element to be appended to this list.- Returns:
- true
-
addFirst
Deprecated.Description copied from class:CursorableLinkedListInserts the specified element at the beginning of this list. (Equivalent toadd(0,o)).- Overrides:
addFirstin classCursorableLinkedList- Parameters:
o- element to be prepended to this list.- Returns:
- true
-
addLast
Deprecated.Description copied from class:CursorableLinkedListInserts the specified element at the end of this list. (Equivalent toCursorableLinkedList.add(java.lang.Object)).- Overrides:
addLastin classCursorableLinkedList- Parameters:
o- element to be appended to this list.- Returns:
- true
-
removeAll
Deprecated.Description copied from class:CursorableLinkedListRemoves from this list all the elements that are contained in the specified collection.- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceList- Overrides:
removeAllin classCursorableLinkedList- Parameters:
c- collection that defines which elements will be removed from this list.- Returns:
- true if this list changed as a result of the call.
-
containsAll
Deprecated.Description copied from class:CursorableLinkedListReturns true if this list contains all of the elements of the specified collection.- Specified by:
containsAllin interfaceCollection- Specified by:
containsAllin interfaceList- Overrides:
containsAllin classCursorableLinkedList- Parameters:
c- collection to be checked for containment in this list.- Returns:
- true if this list contains all of the elements of the specified collection.
-
addAll
Deprecated.Description copied from class:CursorableLinkedListInserts all of the elements in the specified collection into this list at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specifiedCollection'sIterator. 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.)- Specified by:
addAllin interfaceList- Overrides:
addAllin classCursorableLinkedList- Parameters:
index- index at which to insert first element from the specified collection.c- elements to be inserted into this list.- Returns:
- true if this list changed as a result of the call.
-
hashCode
public int hashCode()Deprecated.Description copied from class:CursorableLinkedListReturns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation: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.- Specified by:
hashCodein interfaceCollection- Specified by:
hashCodein interfaceList- Overrides:
hashCodein classCursorableLinkedList- Returns:
- the hash code value for this list.
- See Also:
-
retainAll
Deprecated.Description copied from class:CursorableLinkedListRetains only the elements in this list that are contained in the specified collection. In other words, removes from this list all the elements that are not contained in the specified collection.- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceList- Overrides:
retainAllin classCursorableLinkedList- Parameters:
c- collection that defines which elements this set will retain.- Returns:
- true if this list changed as a result of the call.
-
set
Deprecated.Description copied from class:CursorableLinkedListReplaces the element at the specified position in this list with the specified element.- Specified by:
setin interfaceList- Overrides:
setin classCursorableLinkedList- Parameters:
index- index of element to replace.element- element to be stored at the specified position.- Returns:
- the element previously at the specified position.
-
equals
Deprecated.Description copied from class:CursorableLinkedListCompares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.- Specified by:
equalsin interfaceCollection- Specified by:
equalsin interfaceList- Overrides:
equalsin classCursorableLinkedList- Parameters:
o- the object to be compared for equality with this list.- Returns:
- true if the specified object is equal to this list.
-
get
Deprecated.Description copied from class:CursorableLinkedListReturns the element at the specified position in this list.- Specified by:
getin interfaceList- Overrides:
getin classCursorableLinkedList- Parameters:
index- index of element to return.- Returns:
- the element at the specified position in this list.
-
getFirst
Deprecated.Description copied from class:CursorableLinkedListReturns the element at the beginning of this list.- Overrides:
getFirstin classCursorableLinkedList
-
getLast
Deprecated.Description copied from class:CursorableLinkedListReturns the element at the end of this list.- Overrides:
getLastin classCursorableLinkedList
-
add
Deprecated.Description copied from class:CursorableLinkedListInserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Specified by:
addin interfaceList- Overrides:
addin classCursorableLinkedList- Parameters:
index- index at which the specified element is to be inserted.element- element to be inserted.
-
listIterator
Deprecated.Description copied from class:CursorableLinkedListReturns a fail-fast ListIterator.- Specified by:
listIteratorin interfaceList- Overrides:
listIteratorin classCursorableLinkedList- See Also:
-
remove
Deprecated.Description copied from class:CursorableLinkedListRemoves the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.- Specified by:
removein interfaceList- Overrides:
removein classCursorableLinkedList- Parameters:
index- the index of the element to removed.- Returns:
- the element previously at the specified position.
-
indexOf
Deprecated.Description copied from class:CursorableLinkedListReturns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Specified by:
indexOfin interfaceList- Overrides:
indexOfin classCursorableLinkedList- Parameters:
o- element to search for.- Returns:
- the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
-
lastIndexOf
Deprecated.Description copied from class:CursorableLinkedListReturns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Specified by:
lastIndexOfin interfaceList- Overrides:
lastIndexOfin classCursorableLinkedList- Parameters:
o- element to search for.- Returns:
- the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
-
listIterator
Deprecated.Description copied from class:CursorableLinkedListReturns a fail-fast ListIterator.- Specified by:
listIteratorin interfaceList- Overrides:
listIteratorin classCursorableLinkedList- See Also:
-
subList
Deprecated.Description copied from class:CursorableLinkedListReturns a fail-fast sublist.- Specified by:
subListin interfaceList- Overrides:
subListin classCursorableLinkedList- See Also:
-
insertListable
protected CursorableLinkedList.Listable insertListable(CursorableLinkedList.Listable before, CursorableLinkedList.Listable after, Object value) Deprecated.Inserts a new value into my list, after the specified before element, and before the specified after element- Overrides:
insertListablein classCursorableLinkedList- Returns:
- the newly created
CursorableLinkedList.Listable
-
removeListable
Deprecated.Removes the givenCursorableLinkedList.Listablefrom my list.- Overrides:
removeListablein classCursorableLinkedList
-
checkForComod
Deprecated.Test to see if my underlying list has been modified by some other process. If it has, throws aConcurrentModificationException, otherwise quietly returns.- Throws:
ConcurrentModificationException
-