iterate

inline fun <Type> GdxArray<Type>.iterate(action: (Type, MutableIterator<Type>) -> Unit)

Allows to iterate over the array with access to MutableIterator, which allows to remove elements from the collection during iteration.

Parameters

action

will be invoked for each array element. Allows to remove elements during iteration. The first function argument is the element from the array, the second is the array iterator. The iterator is guaranteed to be the same instance during one iteration.


inline fun <Key, Value> GdxMap<Key, Value>.iterate(action: (Key, Value, MutableIterator<ObjectMap.Entry<Key, Value>>) -> Unit)

Allows to iterate over the map with Kotlin lambda syntax and direct access to MutableIterator, which can remove elements during iteration.

Parameters

action

will be invoked on each key and value pair. Passed iterator is ensured to be the same instance throughout the iteration. It can be used to remove elements.


inline fun <Type> GdxSet<Type>.iterate(action: (Type, MutableIterator<Type>) -> Unit)

Allows to iterate over the array with access to MutableIterator, which allows to remove elements from the collection during iteration.

Parameters

action

will be invoked for each set element. Allows to remove elements during iteration. The first function argument is the element from the set, the second is the set iterator. The iterator is guaranteed to be the same instance during one iteration.