Package arc.struct
Class DelayedRemovalSeq<T>
java.lang.Object
arc.struct.Seq<T>
arc.struct.DelayedRemovalSeq<T>
Queues any removals done after
begin()
is called to occur once end()
is called. This can allow code out of
your control to remove items without affecting iteration. Between begin and end, most mutator methods will throw
IllegalStateException. Only remove(int)
, remove(Object, boolean)
, removeRange(int, int)
,
clear()
, and add methods are allowed.
Code using this class must not rely on items being removed immediately. Consider using SnapshotSeq
if this is a
problem.
-
Nested Class Summary
Nested classes/interfaces inherited from class arc.struct.Seq
Seq.SeqIterable<T>
-
Field Summary
Fields inherited from class arc.struct.Seq
items, iteratorsAllocated, ordered, size
-
Constructor Summary
ConstructorDescriptionDelayedRemovalSeq
(boolean ordered, int capacity) DelayedRemovalSeq
(boolean ordered, int capacity, Class<?> arrayType) DelayedRemovalSeq
(boolean ordered, T[] array, int startIndex, int count) DelayedRemovalSeq
(int capacity) DelayedRemovalSeq
(Seq<? extends T> array) DelayedRemovalSeq
(Class<?> arrayType) DelayedRemovalSeq
(T[] array) -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
clear()
void
end()
void
pop()
Removes and returns the last item.remove
(int index) Removes and returns the item at the specified index.boolean
Removes the first instance of the specified value in the array.void
removeRange
(int start, int end) Removes the items between the specified indices, inclusive.reverse()
void
T[]
setSize
(int newSize) Sets the array size, leaving any values beyond the current size null.shuffle()
sort()
Sorts this array.sort
(Comparator<? super T> comparator) Sorts the array.void
swap
(int first, int second) void
truncate
(int newSize) Reduces the size of the array to the specified size.static <T> DelayedRemovalSeq<T>
with
(T... array) Methods inherited from class arc.struct.Seq
add, add, add, add, add, add, addAll, addAll, addAll, addAll, addAll, addUnique, allMatch, any, as, asMap, asMap, asSet, contains, contains, contains, containsAll, containsAll, copy, count, distinct, each, each, ensureCapacity, equals, filter, find, first, firstOpt, flatMap, flatten, get, getFrac, hashCode, indexOf, indexOf, indexOf, isEmpty, iterator, lastIndexOf, list, map, mapFloat, mapInt, max, max, min, min, min, peek, pop, random, random, random, reduce, remove, remove, removeAll, removeAll, removeAll, replace, replace, resize, retainAll, select, select, selectFrom, selectRanked, selectRankedIndex, set, set, shrink, sort, sortComparing, sum, sumf, toArray, toArray, toString, toString, toString, with, with, withArrays
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DelayedRemovalSeq
public DelayedRemovalSeq() -
DelayedRemovalSeq
-
DelayedRemovalSeq
-
DelayedRemovalSeq
public DelayedRemovalSeq(boolean ordered, int capacity) -
DelayedRemovalSeq
-
DelayedRemovalSeq
-
DelayedRemovalSeq
public DelayedRemovalSeq(int capacity) -
DelayedRemovalSeq
-
-
Method Details
-
with
- See Also:
-
begin
public void begin() -
end
public void end() -
remove
Description copied from class:Seq
Removes the first instance of the specified value in the array. -
remove
Description copied from class:Seq
Removes and returns the item at the specified index. -
removeRange
public void removeRange(int start, int end) Description copied from class:Seq
Removes the items between the specified indices, inclusive.- Overrides:
removeRange
in classSeq<T>
-
clear
-
set
-
insert
-
swap
public void swap(int first, int second) -
pop
Description copied from class:Seq
Removes and returns the last item. -
sort
Description copied from class:Seq
Sorts this array. The array elements must implementComparable
. This method is not thread safe (usesSort.instance()
). -
sort
Description copied from class:Seq
Sorts the array. This method is not thread safe (usesSort.instance()
). -
reverse
-
shuffle
-
truncate
public void truncate(int newSize) Description copied from class:Seq
Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is taken. -
setSize
Description copied from class:Seq
Sets the array size, leaving any values beyond the current size null.
-