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
ConstructorsConstructorDescriptionDelayedRemovalSeq(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 TypeMethodDescriptionvoidbegin()clear()voidend()voidpop()Removes and returns the last item.remove(int index) Removes and returns the item at the specified index.booleanRemoves the first instance of the specified value in the array.voidremoveRange(int start, int end) Removes the items between the specified indices, inclusive.reverse()voidT[]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.voidswap(int first, int second) voidtruncate(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, find, first, firstOpt, flatMap, flatten, get, getFrac, groupBy, groupByCount, hashCode, indexOf, indexOf, indexOf, isEmpty, iterator, lastIndexOf, list, map, mapFloat, mapInt, mapInt, max, max, max, min, 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, toArray, toString, toString, toString, with, with, withArraysMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:SeqRemoves the first instance of the specified value in the array. -
remove
Description copied from class:SeqRemoves and returns the item at the specified index. -
removeRange
public void removeRange(int start, int end) Description copied from class:SeqRemoves the items between the specified indices, inclusive.- Overrides:
removeRangein classSeq<T>
-
clear
-
set
-
insert
-
swap
public void swap(int first, int second) -
pop
Description copied from class:SeqRemoves and returns the last item. -
sort
Description copied from class:SeqSorts this array. The array elements must implementComparable. This method is not thread safe (usesSort.instance()). -
sort
Description copied from class:SeqSorts the array. This method is not thread safe (usesSort.instance()). -
reverse
-
shuffle
-
truncate
public void truncate(int newSize) Description copied from class:SeqReduces 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:SeqSets the array size, leaving any values beyond the current size null.
-