Package-level declarations

Types

Link copied to clipboard
typealias GdxArray<Element> = Array<Element>

Alias for com.badlogic.gdx.utils.Array avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxArrayMap<Key, Value> = ArrayMap<Key, Value>

Alias for com.badlogic.gdx.utils.ArrayMap. Added for consistency with other collections and factory methods.

Link copied to clipboard
typealias GdxBooleanArray = BooleanArray

Alias for com.badlogic.gdx.utils.BooleanArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxByteArray = ByteArray

Alias for com.badlogic.gdx.utils.ByteArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxCharArray = CharArray

Alias for com.badlogic.gdx.utils.CharArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxFloatArray = FloatArray

Alias for com.badlogic.gdx.utils.FloatArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxIdentityMap<Key, Value> = IdentityMap<Key, Value>

Alias for com.badlogic.gdx.utils.IdentityMap. Added for consistency with other collections and factory methods.

Link copied to clipboard
typealias GdxIntArray = IntArray

Alias for com.badlogic.gdx.utils.IntArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxLongArray = LongArray

Alias for com.badlogic.gdx.utils.LongArray avoiding name collision with the standard library.

Link copied to clipboard
typealias GdxMap<Key, Value> = ObjectMap<Key, Value>

Alias for com.badlogic.gdx.utils.ObjectMap. Added for consistency with other collections and factory methods.

Link copied to clipboard
typealias GdxSet<Element> = ObjectSet<Element>

Alias for com.badlogic.gdx.utils.ObjectSet. Added for consistency with other collections and factory methods.

Link copied to clipboard
typealias GdxShortArray = ShortArray

Alias for com.badlogic.gdx.utils.ShortArray avoiding name collision with the standard library.

Properties

Link copied to clipboard
const val defaultArraySize: Int = 16

Default libGDX array size used by most constructors.

Link copied to clipboard
const val defaultLoadFactor: Float = 0.8f

Default libGDX map and set load factor used by most constructors.

Link copied to clipboard
const val defaultMapSize: Int = 51

Default libGDX map size used by most constructors.

Link copied to clipboard
const val defaultSetSize: Int = 51

Default libGDX set size used by most constructors.

Link copied to clipboard

Returns the last valid index for the array. -1 if the array is empty.

Functions

Link copied to clipboard
fun <Type> GdxArray<Type>.addAll(elements: Iterable<Type>)
fun <Type> GdxSet<Type>.addAll(elements: Iterable<Type>)
Link copied to clipboard
inline operator fun IntFloatMap.Entry.component1(): Int

Allows to destruct IntFloatMap.Entry into key and value components.

inline operator fun IntIntMap.Entry.component1(): Int

Allows to destruct IntIntMap.Entry into key and value components.

inline operator fun <Value> IntMap.Entry<Value>.component1(): Int

Allows to destruct IntMap.Entry into key and value components.

inline operator fun <Value> LongMap.Entry<Value>.component1(): Long

Allows to destruct LongMap.Entry into key and value components.

inline operator fun <Value> ObjectIntMap.Entry<Value>.component1(): Value

Allows to destruct ObjectIntMap.Entry into key and value components.

inline operator fun <Key, Value> ObjectMap.Entry<Key, Value>.component1(): Key

Allows to destruct ObjectMap.Entry into key and value components.

Link copied to clipboard
inline operator fun IntFloatMap.Entry.component2(): Float

Allows to destruct IntFloatMap.Entry into key and value components.

inline operator fun IntIntMap.Entry.component2(): Int

Allows to destruct IntIntMap.Entry into key and value components.

inline operator fun <Value> IntMap.Entry<Value>.component2(): Value?

Allows to destruct IntMap.Entry into key and value components. Nullable, since IntMap allows null values.

inline operator fun <Value> LongMap.Entry<Value>.component2(): Value?

Allows to destruct LongMap.Entry into key and value components. Nullable, since LongMap allows null values.

inline operator fun <Value> ObjectIntMap.Entry<Value>.component2(): Int

Allows to destruct ObjectIntMap.Entry into key and value components.

inline operator fun <Key, Value> ObjectMap.Entry<Key, Value>.component2(): Value?

Allows to destruct ObjectMap.Entry into key and value components. Nullable, since ObjectMap allows null values.

Link copied to clipboard
operator fun <Type> GdxArray<Type>.contains(element: Type): Boolean

Allows to check if an array contains an element using the "in" operator.

operator fun IntFloatMap.contains(key: Int): Boolean
operator fun IntIntMap.contains(key: Int): Boolean
operator fun IntMap<*>.contains(key: Int): Boolean
operator fun <Key> GdxMap<Key, *>.contains(key: Key): Boolean
Link copied to clipboard
inline fun <Type> GdxArray<Type>.filter(predicate: (Type) -> Boolean): GdxArray<Type>

Returns a GdxArray containing only elements matching the given predicate.

inline fun <Key, Value> GdxMap<Key, Value>.filter(predicate: (ObjectMap.Entry<Key, Value>) -> Boolean): GdxMap<Key, Value>

Returns a GdxMap containing only entries matching the given predicate.

inline fun <Type> GdxSet<Type>.filter(predicate: (Type) -> Boolean): GdxSet<Type>

Returns a GdxSet containing only elements matching the given predicate.

Link copied to clipboard
inline fun <Type, R> GdxArray<Type>.flatMap(transform: (Type) -> Iterable<R>): GdxArray<R>

Returns a single GdxArray of all elements yielded from results of transform function being invoked on each entry of original GdxArray.

inline fun <Key, Value, R> GdxMap<Key, Value>.flatMap(transform: (ObjectMap.Entry<Key, Value>) -> Iterable<R>): GdxArray<R>

Returns a single GdxArray of all elements yielded from results of transform function being invoked on each entry of original GdxMap.

inline fun <Type, R> GdxSet<Type>.flatMap(transform: (Type) -> Iterable<R>): GdxSet<R>

Returns a single GdxSet of all elements yielded from results of transform function being invoked on each element of original GdxSet.

Link copied to clipboard
inline fun <Type, C : Iterable<Type>> GdxArray<out C>.flatten(): GdxArray<Type>

Returns a single GdxArray of all elements from all collections in the given GdxArray.

inline fun <Key, Type, Value : Iterable<Type>> GdxMap<Key, out Value>.flatten(): GdxArray<Type>

Returns a single GdxArray of all elements from all collections in the given GdxMap.

inline fun <Type, C : Iterable<Type>> GdxSet<out C>.flatten(): GdxSet<Type>

Returns a single GdxSet of all elements from all collections in the given GdxSet.

Link copied to clipboard
inline fun <Type : Any> gdxArrayOf(vararg elements: Type): GdxArray<Type>
inline fun <Type : Any> gdxArrayOf(ordered: Boolean = true, initialCapacity: Int = defaultArraySize): GdxArray<Type>
Link copied to clipboard
Link copied to clipboard
fun gdxByteArrayOf(vararg elements: Byte): GdxByteArray
Link copied to clipboard
fun gdxCharArrayOf(vararg elements: Char): GdxCharArray
Link copied to clipboard
fun gdxFloatArrayOf(vararg elements: Float): GdxFloatArray
Link copied to clipboard
fun <Key, Value> gdxIdentityMapOf(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): GdxIdentityMap<Key, Value>
inline fun <Key, Value> gdxIdentityMapOf(vararg keysToValues: Pair<Key, Value>, initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): GdxIdentityMap<Key, Value>
Link copied to clipboard
fun gdxIntArrayOf(vararg elements: Int): GdxIntArray
Link copied to clipboard
fun gdxIntFloatMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): IntFloatMap
Link copied to clipboard
fun gdxIntIntMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): IntIntMap
Link copied to clipboard
fun <Value> gdxIntMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): IntMap<Value>
Link copied to clipboard
fun gdxLongArrayOf(vararg elements: Long): GdxLongArray
Link copied to clipboard
fun <Key, Value> gdxMapOf(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): GdxMap<Key, Value>
inline fun <Key, Value> gdxMapOf(vararg keysToValues: Pair<Key, Value>, initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor): GdxMap<Key, Value>
Link copied to clipboard
fun <Type> gdxSetOf(initialCapacity: Int = defaultSetSize, loadFactor: Float = defaultLoadFactor): GdxSet<Type>
inline fun <Type> gdxSetOf(vararg elements: Type, initialCapacity: Int = defaultSetSize, loadFactor: Float = defaultLoadFactor): GdxSet<Type>
Link copied to clipboard
fun gdxShortArrayOf(vararg elements: Short): GdxShortArray
Link copied to clipboard
operator fun IntFloatMap.get(key: Int): Float
operator fun IntIntMap.get(key: Int): Int
operator fun <Type> GdxArray<Type>.get(index: Int, alternative: Type): Type
Link copied to clipboard
inline fun <Key, Value> GdxArrayMap<Key, Value>.getOrPut(key: Key, defaultValue: () -> Value): Value
inline fun <Key, Value> GdxIdentityMap<Key, Value>.getOrPut(key: Key, defaultValue: () -> Value): Value
inline fun <Value> IntMap<Value>.getOrPut(key: Int, defaultValue: () -> Value): Value
inline fun <Key, Value> GdxMap<Key, Value>.getOrPut(key: Key, defaultValue: () -> Value): Value

Returns the value for the given key. If the key is not found in the map, calls the defaultValue function, puts its result into the map under the given key and returns it.

Link copied to clipboard
inline fun <Type> GdxArray<Type>?.isEmpty(): Boolean
inline fun GdxMap<*, *>?.isEmpty(): Boolean
inline fun <Type> GdxSet<Type>?.isEmpty(): Boolean
Link copied to clipboard
inline fun <Type> GdxArray<Type>?.isNotEmpty(): Boolean
inline fun GdxMap<*, *>?.isNotEmpty(): Boolean
inline fun <Type> GdxSet<Type>?.isNotEmpty(): Boolean
Link copied to clipboard
inline fun <Type> GdxArray<Type>.iterate(action: (Type, MutableIterator<Type>) -> Unit)
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.

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.

Link copied to clipboard
inline fun <Type, R> GdxArray<Type>.map(transform: (Type) -> R): GdxArray<R>

Returns a GdxArray containing the results of applying the given transform function to each element in the original GdxArray.

inline fun <Key, Value, R> GdxMap<Key, Value>.map(transform: (ObjectMap.Entry<Key, Value>) -> R): GdxMap<Key, R>

Returns a GdxMap containing the results of applying the given transform function to each entry in the original GdxMap.

inline fun <Type, R> GdxSet<Type>.map(transform: (Type) -> R): GdxSet<R>

Returns a GdxSet containing the results of applying the given transform function to each entry in the original GdxSet.

Link copied to clipboard
operator fun <Type> GdxArray<Type>.minus(element: Type): GdxArray<Type>

Allows to remove elements from arrays with array - element syntax.

operator fun <Type> GdxArray<Type>.minus(elements: Array<out Type>): GdxArray<Type>

Allows to quickly remove all elements of a native array from this array with -= operator syntax.

operator fun <Type> GdxArray<Type>.minus(elements: Iterable<Type>): GdxArray<Type>

Allows to quickly remove all elements of another iterable from this array with - operator syntax.

operator fun <Type> GdxSet<Type>.minus(element: Type): GdxSet<Type>

Allows to remove elements from sets with set - element syntax.

operator fun <Type> GdxSet<Type>.minus(elements: Array<out Type>): GdxSet<Type>

Allows to remove all elements of an array from this set with - operator syntax.

operator fun <Type> GdxSet<Type>.minus(elements: Iterable<Type>): GdxSet<Type>

Allows to remove all elements of another iterable from this set with - operator syntax.

Link copied to clipboard
operator fun <Type> GdxArray<Type>.minusAssign(element: Type)

Allows to remove elements from arrays with array -= element syntax.

operator fun <Type> GdxArray<Type>.minusAssign(elements: Array<out Type>)

Allows to quickly remove all elements of a native array from this array with -= operator syntax.

operator fun <Type> GdxArray<Type>.minusAssign(elements: Iterable<Type>)

Allows to quickly remove all elements of another iterable from this array with -= operator syntax.

operator fun <Type> GdxSet<Type>.minusAssign(element: Type)

Allows to remove elements from sets -= operator syntax.

operator fun <Type> GdxSet<Type>.minusAssign(elements: Array<out Type>)

Allows to remove all elements of an array from this set with -= operator syntax.

operator fun <Type> GdxSet<Type>.minusAssign(elements: Iterable<Type>)

Allows to remove all elements of another iterable from this set with -= operator syntax.

Link copied to clipboard
operator fun <Type> GdxArray<Type>.plus(element: Type): GdxArray<Type>

Creates a new GdxArray with appended element.

operator fun <Type> GdxArray<Type>.plus(elements: Array<out Type>): GdxArray<Type>

Allows to quickly addAll all elements of a native array to this array with a pleasant, chainable operator syntax.

operator fun <Type> GdxArray<Type>.plus(elements: Collection<Type>): GdxArray<Type>
operator fun <Type> GdxArray<Type>.plus(elements: Iterable<Type>): GdxArray<Type>

Creates a new GdxArray with appended elements.

operator fun <Type> GdxSet<Type>.plus(element: Type): GdxSet<Type>

Allows to append elements to sets with set + element syntax.

operator fun <Type> GdxSet<Type>.plus(elements: Array<out Type>): GdxSet<Type>

Allows to add all elements of an array to this set with + operator syntax.

operator fun <Type> GdxSet<Type>.plus(elements: Iterable<Type>): GdxSet<Type>

Allows to add all elements of another iterable to this set with + operator syntax.

Link copied to clipboard
operator fun <Type> GdxArray<Type>.plusAssign(element: Type)

Allows to append elements to arrays with array += element syntax.

operator fun <Type> GdxArray<Type>.plusAssign(elements: Array<out Type>)

Allows to quickly add all elements of a native array to this array with += operator syntax.

operator fun <Type> GdxArray<Type>.plusAssign(elements: Iterable<Type>)

Allows to quickly add all elements of another iterable to this array with += operator syntax.

operator fun <Type> GdxSet<Type>.plusAssign(element: Type)

Allows to append elements to sets with += operator syntax.

operator fun <Type> GdxSet<Type>.plusAssign(elements: Array<out Type>)

Allows to add all elements of an array to this set with += operator syntax.

operator fun <Type> GdxSet<Type>.plusAssign(elements: Iterable<Type>)

Allows to add all elements of another iterable to this set with += operator syntax.

Link copied to clipboard
fun <Type> GdxSet<Type>.removeAll(elements: Array<out Type>)
fun <Type> GdxSet<Type>.removeAll(elements: Iterable<Type>)
fun <Type> GdxArray<Type>.removeAll(elements: Array<out Type>, identity: Boolean = false)
fun <Type> GdxArray<Type>.removeAll(elements: Iterable<Type>, identity: Boolean = false)

inline fun <Type> GdxArray<Type>.removeAll(pool: Pool<Type>? = null, predicate: (Type) -> Boolean): Boolean

Removes elements from the array that satisfy the predicate.

Link copied to clipboard
inline fun <Type> GdxArray<Type>.retainAll(pool: Pool<Type>? = null, predicate: (Type) -> Boolean): Boolean

Removes elements from the array that do not satisfy the predicate.

Link copied to clipboard
operator fun <Key, Value> GdxArrayMap<Key, Value>.set(key: Key, value: Value): Int
operator fun IntFloatMap.set(key: Int, value: Float)
operator fun IntIntMap.set(key: Int, value: Int)
operator fun <Value> IntMap<Value>.set(key: Int, value: Value): Value?
operator fun <Key, Value> GdxMap<Key, Value>.set(key: Key, value: Value): Value?
Link copied to clipboard
inline fun <Type> GdxArray<Type>?.size(): Int

A method wrapper over Array.size variable compatible with nullable types.

inline fun GdxBooleanArray?.size(): Int

A method wrapper over BooleanArray.size variable compatible with nullable types.

inline fun GdxFloatArray?.size(): Int

A method wrapper over FloatArray.size variable compatible with nullable types.

inline fun GdxIntArray?.size(): Int

A method wrapper over IntArray.size variable compatible with nullable types.

inline fun GdxMap<*, *>?.size(): Int

A method wrapper over ObjectMap.size variable compatible with nullable types.

inline fun <Type> GdxSet<Type>?.size(): Int

A method wrapper over ObjectSet.size variable compatible with nullable types.

Link copied to clipboard
inline fun <Type, R : Comparable<R>> GdxArray<out Type>.sortBy(crossinline selector: (Type) -> R?)

Sorts elements in the array in-place according to natural sort order of the value returned by specified selector function.

Link copied to clipboard
inline fun <Type, R : Comparable<R>> GdxArray<out Type>.sortByDescending(crossinline selector: (Type) -> R?)

Sorts elements in the array in-place descending according to natural sort order of the value returned by specified selector function.

Link copied to clipboard

Sorts elements in the array in-place descending according to their natural sort order.

Link copied to clipboard
inline fun <Type : Any> GdxSet<Type>.toGdxArray(ordered: Boolean = true, initialCapacity: Int = this.size): GdxArray<Type>
inline fun <Type : Any> Array<Type>.toGdxArray(ordered: Boolean = true, initialCapacity: Int = this.size): GdxArray<Type>
fun BooleanArray.toGdxArray(ordered: Boolean = true, initialCapacity: Int = this.size): GdxBooleanArray
fun FloatArray.toGdxArray(ordered: Boolean = true, initialCapacity: Int = this.size): GdxFloatArray
fun IntArray.toGdxArray(ordered: Boolean = true, initialCapacity: Int = this.size): GdxIntArray
inline fun <Type : Any> Iterable<Type>.toGdxArray(ordered: Boolean = true, initialCapacity: Int = defaultArraySize): GdxArray<Type>
Link copied to clipboard
inline fun <Key, Value> Array<Value>.toGdxMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor, keyProvider: (Value) -> Key): GdxMap<Key, Value>
inline fun <Key, Value> Iterable<Value>.toGdxMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor, keyProvider: (Value) -> Key): GdxMap<Key, Value>
inline fun <Type, Key, Value> Array<Type>.toGdxMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor, valueProvider: (Type) -> Value, keyProvider: (Type) -> Key): GdxMap<Key, Value>
inline fun <Type, Key, Value> Iterable<Type>.toGdxMap(initialCapacity: Int = defaultMapSize, loadFactor: Float = defaultLoadFactor, valueProvider: (Type) -> Value, keyProvider: (Type) -> Key): GdxMap<Key, Value>
Link copied to clipboard
fun <Key> GdxMap<Key, *>.toGdxSet(): ObjectSet<Key>
fun <Type : Any> GdxArray<Type>.toGdxSet(initialCapacity: Int = this.size, loadFactor: Float = defaultLoadFactor): GdxSet<Type>
fun <Type> Array<Type>.toGdxSet(initialCapacity: Int = this.size, loadFactor: Float = defaultLoadFactor): GdxSet<Type>
fun IntArray.toGdxSet(initialCapacity: Int = this.size, loadFactor: Float = defaultLoadFactor): IntSet
fun <Type> Iterable<Type>.toGdxSet(initialCapacity: Int = defaultSetSize, loadFactor: Float = defaultLoadFactor): GdxSet<Type>
Link copied to clipboard
inline fun <Type : T, T> GdxArray<Type>.transfer(toArray: GdxArray<T>, predicate: (Type) -> Boolean)

Transfers elements that match the predicate into the selected toArray. The elements will be removed from this array and added toArray.