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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<ITEM>
,java.util.Collection<ITEM>
,java.util.List<ITEM>
,java.util.RandomAccess
public class FreezableArrayList<ITEM> extends ListenableArrayList<ITEM>
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.- Since:
- 5.20
- Author:
- bratseth
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FreezableArrayList()
Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, ITEM e)
boolean
add(ITEM e)
boolean
addAll(int index, java.util.Collection<? extends ITEM> a)
boolean
addAll(java.util.Collection<? extends ITEM> a)
void
clear()
void
freeze()
Irreversibly freezes the content of thisITEM
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
protected void
removeRange(int fromIndex, int toIndex)
boolean
retainAll(java.util.Collection<?> c)
ITEM
set(int index, ITEM e)
-
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
-
-
-
-
Constructor Detail
-
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 Detail
-
freeze
public void freeze()
Irreversibly freezes the content of this
-
add
public boolean add(ITEM e)
- Specified by:
add
in interfacejava.util.Collection<ITEM>
- Specified by:
add
in interfacejava.util.List<ITEM>
- Overrides:
add
in classListenableArrayList<ITEM>
-
add
public void add(int index, ITEM e)
- Specified by:
add
in interfacejava.util.List<ITEM>
- Overrides:
add
in classListenableArrayList<ITEM>
-
addAll
public boolean addAll(java.util.Collection<? extends ITEM> a)
- Specified by:
addAll
in interfacejava.util.Collection<ITEM>
- Specified by:
addAll
in interfacejava.util.List<ITEM>
- Overrides:
addAll
in classListenableArrayList<ITEM>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends ITEM> a)
- Specified by:
addAll
in interfacejava.util.List<ITEM>
- Overrides:
addAll
in classListenableArrayList<ITEM>
-
set
public ITEM set(int index, ITEM e)
- Specified by:
set
in interfacejava.util.List<ITEM>
- Overrides:
set
in classListenableArrayList<ITEM>
-
remove
public ITEM remove(int index)
-
remove
public boolean remove(java.lang.Object o)
-
clear
public void clear()
-
removeRange
protected void removeRange(int fromIndex, int toIndex)
- Overrides:
removeRange
in classjava.util.ArrayList<ITEM>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
-