public class SharedList<T> extends ReifiedArrayList<T> implements ISharedList<T>
DEFAULT_SIZE
Constructor and Description |
---|
SharedList()
Default constructor
|
SharedList(java.lang.Class<?> genericTypeParameter)
Constructor for initializing with the generic type parameter
|
SharedList(int initialSize)
Constructor initializes with an initial collection size.
|
SharedList(int initialSize,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection size and a generic type parameter.
|
SharedList(java.lang.Iterable<? extends T> iterable)
Constructor initializes with an initial collection and this class's generic type parameter
|
SharedList(java.lang.Iterable<? extends T> iterable,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection and this class's generic type parameter
|
SharedList(ReifiedIterable<T> iterable)
Constructor initializes from another reified collection
|
SharedList(T[] array)
Initializes with an array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element)
Inserts the specified element at the specified position in this list.
|
boolean |
add(T t)
Adds an element to the collection.
|
boolean |
addAll(java.util.Collection<? extends T> 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 T> c)
Inserts the specified elements at the specified position in this list.
|
boolean |
addIfAbsent(T item)
Adds an element if it does not exist.
|
void |
clear()
Empties the list and re-creates the internal buffer with a default size.
|
boolean |
contains(java.lang.Object o)
Scans the collection linearly and returns true if the specified element is found.
|
boolean |
containsAll(java.util.Collection<?> c)
Returns true if all elements in the provided collection are contained in this collection.
|
T |
get(int index)
Returns the element at the specified index.
|
int |
indexOf(java.lang.Object o)
Scans the collection linearly from start to end and returns the index of the element specified.
|
boolean |
isEmpty()
Returns true if the list is empty.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over a copy of the collection.
|
int |
lastIndexOf(java.lang.Object o)
Scans the collection linearly from end to start returns the index of the element specified.
|
java.util.ListIterator<T> |
listIterator()
Returns a list iterator over the backing array.
|
java.util.ListIterator<T> |
listIterator(int index)
Returns a list iterator over the backing array, starting at the specified index.
|
void |
lock()
Locks the collection
|
T |
remove(int index)
Removes the element at the specified position.
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence of an element.
|
boolean |
removeAll(java.util.Collection<?> c)
Removes all items in the provided collection from this list.
|
java.lang.Iterable<java.lang.Boolean> |
removeAll(java.lang.Iterable<? extends T> items)
Removes a number of items from the collection.
|
void |
replaceAll(java.util.Collection<? extends T> c)
Clears the list and puts all given elements.
|
boolean |
retainAll(java.util.Collection<?> c)
Removes from this list all items not contained in the given collection.
|
T |
set(int index,
T element)
Replaces the element at the specified position in this list with the specified element.
|
int |
size() |
ReifiedList<T> |
subList(int fromIndex,
int toIndex)
Creates a sub-list from this list.
|
T[] |
toArray()
Returns all elements in an array copy.
|
<T> T[] |
toArray(T[] a)
Returns all elements in an array.
|
ReifiedList<T> |
toList()
Returns a copy of this list.
|
void |
unlock()
Unlocks the collection
|
addAll, getGenericTypeParameter, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll
getGenericTypeParameter
public SharedList()
SuperTypeTokenException
- When called without using anonymous class semantics.public SharedList(java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When the generic type parameter is null.public SharedList(int initialSize)
SuperTypeTokenException
- When called without using anonymous class semantics.java.lang.IllegalArgumentException
- When the size is non positive.public SharedList(int initialSize, java.lang.Class<?> genericTypeParameter)
java.lang.IllegalArgumentException
- When the buffer size is non positive.java.lang.NullPointerException
- When the generic type parameter is null.public SharedList(ReifiedIterable<T> iterable)
java.lang.NullPointerException
- When the argument is nullpublic SharedList(java.lang.Iterable<? extends T> iterable)
java.lang.NullPointerException
- When the argument is nullSuperTypeTokenException
- When called without using anonymous class semantics.public SharedList(java.lang.Iterable<? extends T> iterable, java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When an argument is nullpublic SharedList(T[] array)
java.lang.NullPointerException
- When the argument is nullpublic boolean add(T t)
add
in interface java.util.Collection<T>
add
in interface java.util.List<T>
add
in class ReifiedArrayList<T>
public void add(int index, T element)
add
in interface java.util.List<T>
add
in class ReifiedArrayList<T>
public boolean addAll(java.util.Collection<? extends T> c)
addAll
in interface java.util.Collection<T>
addAll
in interface java.util.List<T>
addAll
in class ReifiedArrayList<T>
public boolean addAll(int index, java.util.Collection<? extends T> c)
addAll
in interface java.util.List<T>
addAll
in class ReifiedArrayList<T>
public boolean addIfAbsent(T item)
addIfAbsent
in interface ISharedList<T>
public void clear()
clear
in interface java.util.Collection<T>
clear
in interface java.util.List<T>
clear
in class ReifiedArrayList<T>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<T>
contains
in interface java.util.List<T>
contains
in class ReifiedArrayList<T>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<T>
containsAll
in interface java.util.List<T>
containsAll
in class ReifiedArrayList<T>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<T>
isEmpty
in interface java.util.List<T>
isEmpty
in class ReifiedArrayList<T>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<T>
indexOf
in class ReifiedArrayList<T>
public java.util.Iterator<T> iterator()
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<T>
lastIndexOf
in class ReifiedArrayList<T>
public java.util.ListIterator<T> listIterator()
listIterator
in interface java.util.List<T>
listIterator
in class ReifiedArrayList<T>
public java.util.ListIterator<T> listIterator(int index)
listIterator
in interface java.util.List<T>
listIterator
in class ReifiedArrayList<T>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<T>
remove
in interface java.util.List<T>
remove
in class ReifiedArrayList<T>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<T>
removeAll
in interface java.util.List<T>
removeAll
in class ReifiedArrayList<T>
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<T>
retainAll
in interface java.util.List<T>
retainAll
in class ReifiedArrayList<T>
public int size()
size
in interface java.util.Collection<T>
size
in interface java.util.List<T>
size
in class ReifiedArrayList<T>
public T[] toArray()
toArray
in interface java.util.Collection<T>
toArray
in interface java.util.List<T>
toArray
in interface ReifiedList<T>
toArray
in class ReifiedArrayList<T>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<T>
toArray
in interface java.util.List<T>
toArray
in class ReifiedArrayList<T>
public ReifiedList<T> toList()
toList
in interface ISharedList<T>
toList
in class ReifiedArrayList<T>
public T get(int index)
get
in interface java.util.List<T>
get
in class ReifiedArrayList<T>
public T set(int index, T element)
set
in interface java.util.List<T>
set
in class ReifiedArrayList<T>
public void replaceAll(java.util.Collection<? extends T> c)
public java.lang.Iterable<java.lang.Boolean> removeAll(java.lang.Iterable<? extends T> items)
public T remove(int index)
remove
in interface java.util.List<T>
remove
in class ReifiedArrayList<T>
public ReifiedList<T> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<T>
subList
in interface ReifiedList<T>
subList
in class ReifiedArrayList<T>