D4.7 – Features of the Abstract Data Type (ADT) List

A list is a data structure that can grow in size at runtime as memory is allocated dynamically.

A list is a generic ADT and usually comes with the following basic methods: add, size, get, isEmpty and remove

Add adds an element to the list, size returns the number of elements in the list, get returns an element from the list but the element remains in the list, remove removes the element from the list for ever. IsEmpty returns true if there are no elements in the list and false if the list contains elements.

Lists can be indexed to allow the program to add and remove elements from specified positions in the list.

Summary of ADT List

  • They have an index
  • They have a size
  • They can grow and shrink
  • They don’t have any gaps

Examples of this can be seen  running in Java in the Powerpoint D4.11