Multi-dimensonal arrays are a pain point in Kotlin


#1

I love so much about Kotlin, but I have found one area where Java is actually friendlier to work with: mutli-dimensional arrays.

Not just in terms of verbosity, but I Think the readability is better in Java.

example:

Java:
int[][] points = new int[10][10];

Kotlin:
val points = Array<Array<Int>>()

at two dimensionals it is managable, but at three or four I think it would be quite ugly.

Or is it possible I have missed a better way to do this?


#2

Could you share your use cases


#3

The simplest use case is a 2d array to represent a grid for a tile based game.

It is not a big deal, but everything else about Kotlin is so nice this jumps out at me.


#4

Ok, thanks


#5

Have you considered adding Ceylon style type aliases? Would solve this problem.


#6

Yes, we are planning to support something like this