tailieunhanh - Bài giảng Cấu trúc dữ liệu: Chương 14 - Nguyễn Xuân Vinh
Bài giảng Cấu trúc dữ liệu - Chương 14: Conllectinons framework introduction to collections, what is a collections framework, collections interface, collections implementations, collections comparision,. | COLLECTIONs FRAMEWORK Nguyễn Xuân Vinh nguyenxuanvinh@ CẤU TRÚC DỮ LIỆU DATA STRUCTURES [214441] Introduction to Collections A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Represent data items that form a natural group, such as: A poker hand (a collection of cards) A mail folder (a collection of letters) A telephone directory (a mapping of names to phone numbers) What is a Collections Framework A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following: Interfaces: These are abstract data types that represent collections Implementations: These are the concrete implementations of the collection interfaces. Algorithms: These are the methods that perform useful computations, such as searching and sorting Collections Interface Collections | COLLECTIONs FRAMEWORK Nguyễn Xuân Vinh nguyenxuanvinh@ CẤU TRÚC DỮ LIỆU DATA STRUCTURES [214441] Introduction to Collections A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Represent data items that form a natural group, such as: A poker hand (a collection of cards) A mail folder (a collection of letters) A telephone directory (a mapping of names to phone numbers) What is a Collections Framework A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following: Interfaces: These are abstract data types that represent collections Implementations: These are the concrete implementations of the collection interfaces. Algorithms: These are the methods that perform useful computations, such as searching and sorting Collections Interface Collections Implementations Collections Implementations Collection Implementations Concrete Classes: Collection HashSet : This class implements the Set interface, backed by a hash table (actually a HashMap instance). It makesno guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time. This class permits the null element. LinkedHashSet : Hash table and linked list implementation of the Set interface, with predictable iteration order. This implementation differs from HashSet in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is the order in which elements were inserted into the set (insertion-order). Note that insertion order is not affected if an element is re-inserted into the set. (An element e is reinserted into a set s if (e) is invoked when (e) would return true immediately prior to the invocation). Interface SortedSet: A .
đang nạp các trang xem trước