Description
LibGDX defines a number of specialized collections that limit garbage collection and store primitives more efficiently. Unfortunately, none of them implement a common interface, including official Java collection interfaces. This makes it difficult to add utilities, as most extension methods have to be rewritten for each collection separately.
We currently support most commonly used LibGDX collections - such as Array
, ObjectSet
and ObjectMap
- but the utilities for the rest of the collections are minimal. See #176 as an example.
The goal of this task is to prepare an automated or semi-automated way of adding utilities for LibGDX collections. This includes:
- Type alias, if the name of the collection clashes with default Kotlin types (e.g.
Array
->GdxArray
). - Factory methods (e.g.
gdxArrayOf
). get
&set
([]
),+
,-
,+=
and-=
operators.lastIndex
property (if applicable).- Missing commonly used methods (e.g.
addAll
,removeAll
). - Conversion methods from common collection types (e.g.
Array.toGdxArray
,Iterable.toGdxArray
).
This can be implemented in form of a Gradle task that generates a basic utilities file and associated test file depending on the settings. It would be ideal if the generated code required no changes, but some manual corrections and additions are acceptable.