How to create a list / map

Hi

Is there special syntax support to create lists and maps from a given number of elements, or do I have to do it like I would in Java? ( Arrays.asList(a,b,c) etc. )

Regards, Etienne

Check out the helper functions in the kotlin package such as arrayList(), linkedList(), hashMap(), sortedMap(), linkedMap(), hashSet(), sortedSet() etc.

val list = arrayList("hey", "kotlin", "rocks")

val map = hashMap("kotlin" to "rocks", "java" to "ok")

Though the to method and tuple creation of maps is pretty new; not sure it made M1 but its in the latest snapshot of standard library.

Thank you, James. Available in M1.

arrayList works in M1, hashMap gives me a compile error.

Etienne

Yeah, hashMap(), sortedMap(), linkedMap() didn't make M1 but are in the 0.1-SNAPSHOT if you want to try it - otherwise they'll be in M2