CSC 216 Lecture Notes - Lecture 4: Iterator, Binary Search Algorithm, Binary Search Tree
Document Summary
Class 4: java collections || building java programs, chapter 10. Examples found in the java class libraries: arraylist, linkedlist, hashmap, treeset, priorityqueue. All collections are in the java. util package: import java. util. List: a collection storing an ordered sequence of elements: index: the number assigned to each element in an index, starting at zero, size: the total number of elements that have been added to a list. Elements can be added to the front, back, or elsewhere. In java, a list can be represented as an arraylist or a linkedlist. [hello, abc, goodbye, okay: the list object keeps track of element values that have been added to it, their order, indexes, and its total size. Think of an array list as an automatically resizing array object. Internally, the list is implemented using an array and a size field. Add(value): appends value at end of list. Add(index, value): inserts given value just before the given index, shifting subsequent values to the right.