Lecture 8
Lecture 8
Lecture 8
Collection
• Output
• Output
• Output
• Output
Method Description
int binarySearch(List list, Object key) search for a specified element in a
sorted list using the binary search
algorithm
void fill(List list, Object obj) Assigns values to elements
void shuffle (List list) Random permutation
void sort (List list) Sort in ascending order
void reverse (List list) reverse the order of elements
void rotate (List list, int distance) rotate the elements in the specified
list
void swap(List list, int i, int j) swap the elements at the specified
positions
• Collection
• Inheritance hierarchy of CollectionConstructor
• List & Array List
• Set & HashSet
• Map & HashMap