a proposal for collection literal val array: Array...
# language-proposals
a proposal for collection literal val array: Array<Long> = [1, 2, 3] val list: List<Long> = [1, 2, 3] val map: Map<String, Long> = ["a" -> 1, "b" -> 2] so, if type is specified we can use [ ... ] literal
👍 3
I'd also like to see
val iDontCareWhatCollectionTypeThisIs = [1, 2, 3]
And while I'd prefer that arrow syntax over the nothing we have now, I'd love it even better as
val map: ["a": 1, "b": 2]
Why do you need arrays, apart from annotations?
Interoperability with Java and other APIs that take arrays and do dirty things to them. Usually low-level stuff like graphics APIs will take in an array and return nothing, just mutate its contents because that's slightly faster.