Package org.restlet.util
Class WrapperList<E>
java.lang.Object
org.restlet.util.WrapperList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>
- Direct Known Subclasses:
ClientList,ReferenceList,RouteList,Series,ServerList,ServiceList
List wrapper. Modifiable list that delegates all methods to a wrapped list.
This allows an easy sub-classing. By default, it wraps a thread-safe
Vector instance.- Author:
- Jerome Louvel
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.WrapperList(int initialCapacity) Constructor.WrapperList(List<E> delegate) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified element at the specified position in this list.booleanAdds a element at the end of the list.booleanaddAll(int index, Collection<? extends E> elements) Inserts all of the elements in the specified collection into this list at the specified position.booleanaddAll(Collection<? extends E> elements) Appends all of the elements in the specified collection to the end of this list.voidclear()Removes all of the elements from this list.booleanReturns true if this list contains the specified element.booleancontainsAll(Collection<?> elements) Returns true if this list contains all of the elements of the specified collection.booleanCompares the specified object with this list for equality.get(int index) Returns the element at the specified position in this list.Returns the delegate list.inthashCode()Returns the hash code value for this list.intReturns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.booleanisEmpty()Returns true if this list contains no elements.iterator()Returns an iterator over the elements in this list in proper sequence.intlastIndexOf(Object element) Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.Returns a list iterator of the elements in this list (in proper sequence).listIterator(int index) Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.remove(int index) Removes the element at the specified position in this list.booleanRemoves the first occurrence in this list of the specified element.booleanremoveAll(Collection<?> elements) Removes from this list all the elements that are contained in the specified collection.booleanretainAll(Collection<?> elements) RemovesRetains only the elements in this list that are contained in the specified collection.Replaces the element at the specified position in this list with the specified element.intsize()Returns the number of elements in this list.subList(int fromIndex, int toIndex) Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.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.toString()Returns a string representation of the list.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
WrapperList
public WrapperList()Constructor. Uses a default initial capacity of 10 items. -
WrapperList
public WrapperList(int initialCapacity) Constructor.- Parameters:
initialCapacity- The initial list capacity.
-
WrapperList
Constructor.- Parameters:
delegate- The delegate list.
-
-
Method Details
-
add
Adds a element at the end of the list. -
add
Inserts the specified element at the specified position in this list. -
addAll
Appends all of the elements in the specified collection to the end of this list. -
addAll
Inserts all of the elements in the specified collection into this list at the specified position. -
clear
public void clear()Removes all of the elements from this list. -
contains
Returns true if this list contains the specified element. -
containsAll
Returns true if this list contains all of the elements of the specified collection.- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>- Parameters:
elements- The collection of elements to find.- Returns:
- True if this list contains all of the elements of the specified collection.
-
equals
Compares the specified object with this list for equality. -
get
Returns the element at the specified position in this list. -
getDelegate
Returns the delegate list.- Returns:
- The delegate list.
-
hashCode
public int hashCode()Returns the hash code value for this list. -
indexOf
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. -
isEmpty
public boolean isEmpty()Returns true if this list contains no elements. -
iterator
Returns an iterator over the elements in this list in proper sequence. -
lastIndexOf
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
Returns a list iterator of the elements in this list (in proper sequence).- Specified by:
listIteratorin interfaceList<E>- Returns:
- A list iterator of the elements in this list (in proper sequence).
-
listIterator
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.- Specified by:
listIteratorin interfaceList<E>- Parameters:
index- The starting position.
-
remove
Removes the element at the specified position in this list. -
remove
Removes the first occurrence in this list of the specified element. -
removeAll
Removes from this list all the elements that are contained in the specified collection. -
retainAll
RemovesRetains only the elements in this list that are contained in the specified collection. -
set
Replaces the element at the specified position in this list with the specified element. -
size
public int size()Returns the number of elements in this list. -
subList
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. -
toArray
Returns an array containing all of the elements in this list in proper sequence. -
toArray
public <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. -
toString
Returns a string representation of the list.
-