public class NoNullArrayList<E> extends ArrayList<E>
modCount| Constructor and Description |
|---|
NoNullArrayList()
Constructs an empty list with default capacity of ten.
|
NoNullArrayList(Collection<E> c)
Constructs a list with the given collection if the collection is not null and does not contain any null elements.
|
NoNullArrayList(int size)
Constructs an empty list of given capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Appends the given element to the end of this list if element is not null.
|
void |
add(int index, E element)
Inserts element in the list at the specified index unless the passed element is null in which case no action is taken.
|
boolean |
addAll(Collection<? extends E> c)
Appends the given collection of elements to the end of this list if collection is not null and doesn't contain any null elements.
|
boolean |
addAll(int index, Collection<? extends E> c)
Appends the given collection of elements starting at given index of this list if collection is not null and doesn't contain any null elements.
|
E |
set(int index, E element)
Set the given element at the specified index in the list if the element is not null.
|
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic NoNullArrayList()
public NoNullArrayList(Collection<E> c)
c - collection of elements to be placed in the listpublic NoNullArrayList(int size)
size - the initial capacity of the listpublic boolean add(E e)
add in interface Collection<E>add in interface List<E>add in class ArrayList<E>e - element to append. cannot be nullIllegalArgumentException - if element is null
public void add(int index,
E element)
public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface List<E>addAll in class ArrayList<E>c - collection to appendIllegalArgumentException - if the given collection is null or contains null
public boolean addAll(int index,
Collection<? extends E> c)
addAll in interface List<E>addAll in class ArrayList<E>index - index at which to start adding the new collectionc - collection to appendIllegalArgumentException - if the given collection is null or contains null IndexOutOfBoundsException if index is out of rangepublic E set(int index, E element)
set in interface List<E>set in class ArrayList<E>index - index of the element to replaceelement - element to save at the locationIllegalArgumentException - if the given element is null IndexOutOfBoundsException if index is out of range