Lecture 7: Collections (continued) Polymorphic algorithms in the Java Collection Framework are reusable functionalities; All algorithms take the form of static methods; Many algorithms operate on List instances. | Lecture 7: Collections (continued) Lê Hồng Phương phuonglh@ Department of Mathematics, Mechanics and Informatics, Vietnam National University, Hanoi Content ● Collections ● Interfaces ● Implementations ● Algorithms ● Exercises August, 2012 2 Algorithms ● ● Polymorphic algorithms in the Java Collection Framework are reusable functionalities. All algorithms take the form of static methods. – ● First argument is the collection to operate Many algorithms operate on List instances. August, 2012 3 Algorithms ● ● Polymorphic algorithms in the Java Collection Framework are reusable functionalities. All algorithms take the form of static methods. – ● First argument is the collection to operate Many algorithms operate on List instances. August, 2012 4 Sorting ● ● The sort algorithm reorders a list so that its elements are in ascending order according to an ordering relationship. Natural ordering: – strings: alphabetic order – numbers: signed numerical order – characters: unsigned numerical order – dates: chronological order – objects: ? August, .