Being a basic data structure, every language supports creating an array. When we talk about Kotlin, an array here's represented by a class called Array present in a kotlin package. Like other classes, it has a few member functions and properties. Let's see what it looks like using the following code:
class Array<T> private constructor() {
val size: Int
operator fun get(index: Int): T
operator fun set(index: Int, value: T): Unit
operator fun iterator(): Iterator <T>
// ...
}
In terms of the preceding code snippet of the Array class defined in the Kotlin core API, we can say that it has a size property to tell us the current size of the array; the get and set functions, which basically overload the [] operator; and an iterator function to let us iterate over the items.
So, using the preceding mentioned properties, we...