1.1-Introductie-Programmeren

Rewrite ArrayList to array

Difficulty: Filled Outlined Outlined

You can find an example of a (top 10) list of boardgames in the code of this exercise. This list is printed in the SaxionApp. Run the code to get a good feel for what the code does.

After you understand how the code works, rewrite the code into an implementation that uses an array. Use an index-based for loop for this.

Finally, look at the difference in code afterwards. Try to see for yourself which list is better in which situation and why. Can you come up with situations where an array is better and situations where an ArrayList is better?

Example

Example