Cùng nắm kiến thức trong chương này thông qua việc tìm hiểu các nội dung sau: Readings and References, Java 2 Collections, Collections Framework, Collections Framework Diagram, Collection Interface, Iterator Position, List Interface Context, ArrayList and LinkedList Context,. | 5/14/2020 6:23:21 AM CÔNG NGHỆ JAVA CH13. JAVA COLLECTIONS Quang Dieu Tran PhD. Readings and References References "Collections", Java tutorial 5/14/2020 6:23:21 AM Java 2 Collections A collection is an object that groups multiple elements into a single unit Very useful store, retrieve and manipulate data transmit data from one method to another data structures and methods written by hotshots in the field Joshua Bloch, who also wrote the Collections tutorial 5/14/2020 6:23:21 AM Collections Framework Unified architecture for representing and manipulating collections. A collections framework contains three things Interfaces Implementations Algorithms 5/14/2020 6:23:21 AM Collections Framework Diagram 5/14/2020 6:23:21 AM Interfaces, Implementations, and Algorithms From Thinking in Java, page 462 Collection Interface Defines fundamental methods int size(); boolean isEmpty(); boolean contains(Object element); boolean add(Object element); // Optional boolean remove(Object element); // Optional Iterator iterator(); These methods are enough to define the basic behavior of a collection Provides an Iterator to step through the elements in the Collection 5/14/2020 6:23:21 AM Iterator Interface Defines three fundamental methods Object next() boolean hasNext() void remove() These three methods provide access to the contents of the collection An Iterator knows position within collection Each call to next() “reads” an element from the collection Then you can use it or remove it 5/14/2020 6:23:21 AM Iterator Position 5/14/2020 6:23:21 AM Example - SimpleCollection public class SimpleCollection { public static void main(String[] args) { Collection c; c = new ArrayList(); (().getName()); for (int i=1; i CÔNG NGHỆ JAVA CH13. JAVA COLLECTIONS Quang Dieu Tran PhD. Readings and References References "Collections", Java tutorial 5/14/2020 6:40:49 AM Java 2 Collections A collection is an object that groups multiple elements into a single unit Very useful store, retrieve and manipulate data transmit data from one method to another data structures and methods written by hotshots in the field Joshua Bloch, who also wrote the Collections tutorial 5/14/2020 6:40:49 AM Collections Framework Unified architecture for representing and manipulating collections. A collections framework contains three things Interfaces Implementations Algorithms 5/14/2020 6:40:49 AM Collections Framework Diagram 5/14/2020 6:40:49 AM Interfaces, Implementations, and Algorithms From Thinking in Java, page 462 Collection Interface Defines fundamental methods int size(); boolean isEmpty(); boolean .