Package com.yahoo.collections
Class FreezableArrayList<ITEM>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<ITEM>
com.yahoo.collections.ListenableArrayList<ITEM>
com.yahoo.collections.FreezableArrayList<ITEM>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<ITEM>,Collection<ITEM>,List<ITEM>,RandomAccess
An array list which can be frozen to disallow further edits.
After freezing, edit operations will throw UnsupportedOperationException.
Freezable lists may optionally allow new items to be added to the end of the list also after freeze.
- Author:
- bratseth
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreates a freezable array list which does not permit adds after freezeFreezableArrayList(boolean permitAddAfterFreeze) FreezableArrayList(boolean permitAddAfterFreeze, int initialCapacity) FreezableArrayList(int initialCapacity) Creates a freezable array list which does not permit adds after freeze -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends ITEM> a) booleanaddAll(Collection<? extends ITEM> a) voidclear()voidfreeze()Irreversibly freezes the content of thisremove(int index) booleanbooleanremoveAll(Collection<?> c) protected voidremoveRange(int fromIndex, int toIndex) booleanretainAll(Collection<?> c) Methods inherited from class com.yahoo.collections.ListenableArrayList
addListener, listenersMethods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
FreezableArrayList
public FreezableArrayList()Creates a freezable array list which does not permit adds after freeze -
FreezableArrayList
public FreezableArrayList(int initialCapacity) Creates a freezable array list which does not permit adds after freeze -
FreezableArrayList
public FreezableArrayList(boolean permitAddAfterFreeze) -
FreezableArrayList
public FreezableArrayList(boolean permitAddAfterFreeze, int initialCapacity)
-
-
Method Details
-
freeze
public void freeze()Irreversibly freezes the content of this -
add
- Specified by:
addin interfaceCollection<ITEM>- Specified by:
addin interfaceList<ITEM>- Overrides:
addin classListenableArrayList<ITEM>
-
add
-
addAll
- Specified by:
addAllin interfaceCollection<ITEM>- Specified by:
addAllin interfaceList<ITEM>- Overrides:
addAllin classListenableArrayList<ITEM>
-
addAll
-
set
-
remove
-
remove
-
clear
public void clear() -
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRangein classArrayList<ITEM>
-
removeAll
-
retainAll
-