SimpleArrayList get and set
Let's begin building a simple list implementation that uses arrays to store the values.
Create a class
SimpleArrayList with a public constructor that initializes the list using a passed non-
Your array should be private.
fun get(Int): Any, which takes an
Intindex and returns the
Anyat that index
fun set(Int, Any?), which takes an
Intindex and an
Anyreference and sets that value at the index to the passed reference.
set method should require that the index passed is valid for that SimpleArrayList.
Here's an example of how your
SimpleArrayList should work:
Don't overthink this! Both
set should be two lines of code (including one for the