CSC 216 Lecture Notes - Lecture 13: Dynamic Array, Array Data Structure, Upper And Lower Bounds
Document Summary
Collections: data structures store elements in a manner that makes it easy for a client to work with elements: specific kinds of collections are specialized for particular kinds of operations, such as . Add/remove: common sets of operations for collections: add, remove, get, contains, size. List: an ordered collection of elements, accessible by a zero-based index: has a size equal to the number of elements in the list, elements can be added to an empty list, at the front, middle, and back. Scenario: suppose a course has a list of enrolled students. We want to be able to enroll, drop, email all the students, etc etc but classes like arrayintlist won"t work with this: options: Create an arraycourselist but then we"ll have to create a custom list for every object type. Create an arraylist of objects but then we"ll have to cast when we get objects out. Working with arraylist: constructing: arraylist list = new.