Package org.ka2ddo.util
Class ArrayBlockList<V>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<V>
org.ka2ddo.util.ArrayBlockList<V>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<V>
,Collection<V>
,List<V>
,RandomAccess
This is an extension to the JRE's java.util.ArrayList with the ability to do block removes
exposed for public use.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionConstructs an empty list with an initial capacity of ten.ArrayBlockList
(int initialCapacity) Constructs an empty list with the specified initial capacity.ArrayBlockList
(Collection<? extends V> c) Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
removeRange
(int fromIndex, int toIndex) Removes from this list all of the elements whose index is betweenfromIndex
, inclusive, andtoIndex
, exclusive.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, 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
-
ArrayBlockList
public ArrayBlockList(int initialCapacity) Constructs an empty list with the specified initial capacity.- Parameters:
initialCapacity
- the initial capacity of the list- Throws:
IllegalArgumentException
- if the specified initial capacity is negative
-
ArrayBlockList
public ArrayBlockList()Constructs an empty list with an initial capacity of ten. -
ArrayBlockList
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
c
- the collection whose elements are to be placed into this list- Throws:
NullPointerException
- if the specified collection is null
-
-
Method Details
-
removeRange
public void removeRange(int fromIndex, int toIndex) Removes from this list all of the elements whose index is betweenfromIndex
, inclusive, andtoIndex
, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by(toIndex - fromIndex)
elements. (IftoIndex==fromIndex
, this operation has no effect.)- Overrides:
removeRange
in classArrayList<V>
- Parameters:
fromIndex
- index of first element to be removedtoIndex
- index after last element to be removed- Throws:
IndexOutOfBoundsException
- if fromIndex or toIndex out of range (fromIndex < 0 || fromIndex >= size() || toIndex > size() || toIndex < fromIndex)
-