Additional extension methods for collections #341
Replies: 1 comment 7 replies
-
Yeah, utilities like that are not available in LibGDX, and since they don't implement any of the standard collection interfaces, Kotlin stdlib doesn't help either. My biggest issue with adding utilities like this is that you have to duplicate code for pretty much all of the collections, since they don't use any custom interfaces or inheritance either. I originally wanted to write a code generator for that, see #275. You'd basically list all of the LibGDX collections with some additional parameters (e.g. collection type, supported elements, aliases), and the utilities would be generated along with tests. However, I didn't have time to work on this so far - besides, most of the LibGDX collections are very rarely used, so I'm not sure if this project would be that important. Anyway, If you want to add a few utilities to the core map collections or try to tackle #275, I'll be happy to review the changes. If you don't have the time, I'd appreciate it if you listed the utility methods that you'd like to see and I will set up a separate issue for that. |
Beta Was this translation helpful? Give feedback.
-
@czyzby are we missing some common map utility functions like
getOrPut
? Or is it part of a different package? I am using ktx-collections.If it is missing, shall we add something like
for all map types? And maybe other typical common utility functions?
Also, is
getOrPut
the same ascomputeIfAbsent
?Beta Was this translation helpful? Give feedback.
All reactions