Tutorial is lacking on how to use collection API

Hi there,

Where can I find docs on how to create simple list, map or set data structure? Is there a literal support on creating these objects?

Thanks,
Zemian

Not a doc but these are few simple samples https://github.com/dodyg/Kotlin101/tree/master/src/Collections. There are some runnable samples in the whole repo - they are still rudimentary right now but it will get better.

I don't think the CI build automatically updates the online kotlin docs with the latest stuff, but there is a brief overview of the collection and other core APIs in the API docs which is generated from this ReadMe.md if folks want to contribute to enhance the docs. It would be nice to document the various helper functions like arrayList(), linkedList(), hashSet(), hashMap() etc.

Thanks for the info James and Dody.

Yeah, I think docs defininately would help to show at least some basics. For example, I notice we have “hashMap()” function, but no where in doc indicate that we can use “to” to convert two objects into Pair. So a quick example would help user move along quicker.

val list = arrayList(1, 2, 3, 4, 5) val map = hashMap("foo" to 123, "bar" to 456)

Zemian

There are actually lots of snippets of example code, however they are all inside the documentation for different API methods. e.g. here's map().

e.g. a good place to start is the detailed docs on each extension method on java.util.List or java.util.Map.

We maybe need better links into those bits of doc :slight_smile: they are a little hard to spot right now