Package com.prineside.tdi2.utils
Class StrictArray<T>
java.lang.Object
com.badlogic.gdx.utils.Array<T>
com.prineside.tdi2.utils.StrictArray<T>
- All Implemented Interfaces:
Iterable<T>
public class StrictArray<T>
extends com.badlogic.gdx.utils.Array<T>
Не позволяет удалять элементы во время итерации
Вложенная итерация разрешена
-
Nested Class Summary
Nested classes/interfaces inherited from class com.badlogic.gdx.utils.Array
com.badlogic.gdx.utils.Array.ArrayIterable<T>, com.badlogic.gdx.utils.Array.ArrayIterator<T>
-
Field Summary
Fields inherited from class com.badlogic.gdx.utils.Array
items, ordered, size
-
Constructor Summary
ConstructorsConstructorDescriptionStrictArray
(boolean ordered, int capacity) StrictArray
(boolean ordered, int capacity, Class arrayType) StrictArray
(boolean ordered, T[] array, int startIndex, int count) StrictArray
(int capacity) StrictArray
(com.badlogic.gdx.utils.Array array) StrictArray
(Class arrayType) StrictArray
(T[] array) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bi()
void
clear()
void
ei()
void
pop()
Removes and returns the last item.boolean
Removes from this array all of elements contained in the specified array.removeIndex
(int index) Removes and returns the item at the specified index.void
removeRange
(int start, int end) Removes the items between the specified indices, inclusive.boolean
removeValue
(T value, boolean identity) Removes the first instance of the specified value in the array.void
reverse()
void
T[]
setSize
(int newSize) Sets the array size, leaving any values beyond the current size null.void
shuffle()
void
sort()
Sorts this array.void
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.Methods inherited from class com.badlogic.gdx.utils.Array
add, add, add, add, addAll, addAll, addAll, addAll, contains, containsAll, containsAny, ensureCapacity, equals, equalsIdentity, first, get, hashCode, indexOf, insertRange, isEmpty, iterator, lastIndexOf, notEmpty, of, of, peek, random, select, selectRanked, selectRankedIndex, shrink, toArray, toArray, toString, toString, with
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
StrictArray
public StrictArray() -
StrictArray
public StrictArray(com.badlogic.gdx.utils.Array array) -
StrictArray
-
StrictArray
public StrictArray(boolean ordered, int capacity) -
StrictArray
-
StrictArray
-
StrictArray
public StrictArray(int capacity) -
StrictArray
-
-
Method Details
-
bi
public void bi() -
ei
public void ei() -
set
- Overrides:
set
in classcom.badlogic.gdx.utils.Array<T>
-
insert
- Overrides:
insert
in classcom.badlogic.gdx.utils.Array<T>
-
swap
public void swap(int first, int second) - Overrides:
swap
in classcom.badlogic.gdx.utils.Array<T>
-
removeValue
Description copied from class:com.badlogic.gdx.utils.Array
Removes the first instance of the specified value in the array.- Overrides:
removeValue
in classcom.badlogic.gdx.utils.Array<T>
- Parameters:
value
- May be null.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.- Returns:
- true if value was found and removed, false otherwise
-
removeIndex
Description copied from class:com.badlogic.gdx.utils.Array
Removes and returns the item at the specified index.- Overrides:
removeIndex
in classcom.badlogic.gdx.utils.Array<T>
-
removeRange
public void removeRange(int start, int end) Description copied from class:com.badlogic.gdx.utils.Array
Removes the items between the specified indices, inclusive.- Overrides:
removeRange
in classcom.badlogic.gdx.utils.Array<T>
-
removeAll
Description copied from class:com.badlogic.gdx.utils.Array
Removes from this array all of elements contained in the specified array.- Overrides:
removeAll
in classcom.badlogic.gdx.utils.Array<T>
identity
- True to use ==, false to use .equals().- Returns:
- true if this array was modified.
-
pop
Description copied from class:com.badlogic.gdx.utils.Array
Removes and returns the last item.- Overrides:
pop
in classcom.badlogic.gdx.utils.Array<T>
-
clear
public void clear()- Overrides:
clear
in classcom.badlogic.gdx.utils.Array<T>
-
setSize
Description copied from class:com.badlogic.gdx.utils.Array
Sets the array size, leaving any values beyond the current size null.- Overrides:
setSize
in classcom.badlogic.gdx.utils.Array<T>
- Returns:
Array.items
-
sort
public void sort()Description copied from class:com.badlogic.gdx.utils.Array
Sorts this array. The array elements must implementComparable
. This method is not thread safe (usesSort.instance()
).- Overrides:
sort
in classcom.badlogic.gdx.utils.Array<T>
-
sort
Description copied from class:com.badlogic.gdx.utils.Array
Sorts the array. This method is not thread safe (usesSort.instance()
).- Overrides:
sort
in classcom.badlogic.gdx.utils.Array<T>
-
reverse
public void reverse()- Overrides:
reverse
in classcom.badlogic.gdx.utils.Array<T>
-
shuffle
public void shuffle()- Overrides:
shuffle
in classcom.badlogic.gdx.utils.Array<T>
-
truncate
public void truncate(int newSize) Description copied from class:com.badlogic.gdx.utils.Array
Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is taken.- Overrides:
truncate
in classcom.badlogic.gdx.utils.Array<T>
-