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
ConstructorDescriptionCreates 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 TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends ITEM> a) boolean
addAll
(Collection<? extends ITEM> a) void
clear()
void
freeze()
Irreversibly freezes the content of thisremove
(int index) boolean
boolean
removeAll
(Collection<?> c) protected void
removeRange
(int fromIndex, int toIndex) boolean
retainAll
(Collection<?> c) Methods inherited from class com.yahoo.collections.ListenableArrayList
addListener, listeners
Methods 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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods 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:
add
in interfaceCollection<ITEM>
- Specified by:
add
in interfaceList<ITEM>
- Overrides:
add
in classListenableArrayList<ITEM>
-
add
-
addAll
- Specified by:
addAll
in interfaceCollection<ITEM>
- Specified by:
addAll
in interfaceList<ITEM>
- Overrides:
addAll
in classListenableArrayList<ITEM>
-
addAll
-
set
-
remove
-
remove
-
clear
public void clear() -
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRange
in classArrayList<ITEM>
-
removeAll
-
retainAll
-