Objectives

Students will be able to:

  • understand that a list is a dynamic data srtucture
  • initialise a new list
  • add, replace and remove items from a list

Intro to ArrayLists

J-Birds

add(object)
add(int, object)
remove(int)
 
ArrayList

J-birds

A fun computer game J-Birds allows teenage J-Freaks to play with their favourite J-Names, eg Jack, Jill, Joe and Jess

The program uses an array data structure to store the names in the game.

Arrays are great when we know how many elements are required to store data in a computer program.

But what if we don't know the number of elements that an array will handle? A good option to use is an Array List.

Play with the simulator above. Can you append, insert and remove names to and from the list?

Task

Copy the starter code into your IDE.

Open the Worksheet and complete the coding tasks.

Submission

Submit your code and worksheet as instructed.

Tags

dynamic static size() add(object) set(int, object) add(int, object)get(int)