I'm new in kotlin and I'm tryng to understand how can I initialize this array in the correct way.
My java code:
private Bitmap[] leftToRights;
private Bitmap[] rightToLefts;
private Bitmap[] topToBottoms;
private Bitmap[] bottomToTops;
//On constructor(colCount = 3)
this.topToBottoms = new Bitmap[colCount]; // 3
this.rightToLefts = new Bitmap[colCount]; // 3
this.leftToRights = new Bitmap[colCount]; // 3
this.bottomToTops = new Bitmap[colCount]; // 3
In Kotlin(my try):
//Declaration
private val leftToRights: Array<Bitmap>
private val rightToLefts: Array<Bitmap>
private val topToBottoms: Array<Bitmap>
private val bottomToTops: Array<Bitmap>
//Init
Array<Bitmap>(colCount,/*Missing argument, what shall I initialize with?*/)
this.topToBottoms = Array<Bitmap>(colCount,/*Missing argument, what shall I initialize with?*)
this.rightToLefts = Array<Bitmap>(colCount,/*Missing argument, what shall I initialize with?*)
this.leftToRights = Array<Bitmap>(colCount,/*Missing argument, what shall I initialize with?*)
this.bottomToTops = Array<Bitmap>(colCount,/*Missing argument, what shall I initialize with?*)
So what is a good way to initialize these arrays same way as java does? Can someone explain how it works in java, does java initialize Bitmap array with null?
Sorry for my english, hope you can understand it. I'm open to any question about this post.