Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide equal set of utilities for LibGDX collections #275

Open
czyzby opened this issue Apr 25, 2020 · 0 comments
Open

Provide equal set of utilities for LibGDX collections #275

czyzby opened this issue Apr 25, 2020 · 0 comments
Labels
collections Issues of the ktx-collections module
Milestone

Comments

@czyzby
Copy link
Member

czyzby commented Apr 25, 2020

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.

@czyzby czyzby added the collections Issues of the ktx-collections module label Apr 25, 2020
@czyzby czyzby added this to the backlog milestone Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Issues of the ktx-collections module
Projects
None yet
Development

No branches or pull requests

1 participant