Chapter 1: Application of collections (1) (1) Java collections Ø Collection classes store object references instead of objects. Ø Set types include set, list, and map ). Ø Set: this is a set that does not sort objects in a specific way, but simply adds objects to the set. There cannot be duplicates in the set. Hashset and treeset. Ø List: The main feature is that its objects are stored in a linear manner, with no specific order. There is only one beginning and one end. Vector: Like an array, it automatically increases the capacity. Using subscript to store and retrieve objects is like in a standard array. STACK: derived from a vector, adds a post-first-out storage structure for method implementation. Linklist: implements a list that can be used like stacks and queues. Array list to implement an array. Ø Hasing: hashtable: implements a ing. All keys must be non-empty. Hashmap: implements an image that allows empty objects to be stored and empty objects to be stored. Treemap objects are arranged in ascending order of keys. Ø A collection class can only accommodate objects. All objects contained in the Collection class are instances of the object class. You must reshape a set Member before using it. Ø The element types in the container are all objects. When getting an element from the container, you must convert it to the original type. Ø The collection interface is a set of objects that can be repeated. The set and list interfaces inherit from the collection interface. (2) List Interface Ø Common classes that implement the list interface include vector, stack, arraylist, and sorted list. Ø The vector class implements variable arrays. Can be accessed by subscript ., If the capacity is full, it will be twice the original capacity. Ø Vector Construction Method: vector () constructs an empty vector so that the size of its internal data array is 10, and its standard capacity increment is zero. Vector (collection <? Extends E> C) construct a vector containing elements in the specified set, which are arranged in the order returned by the iterator of the set. Vector (INT initialcapacity) uses the specified initial capacity and the Capacity Increment equal to zero to construct an empty vector. Vector (INT initialcapacity, int capacityincrement) uses the specified initial capacity and capacity increment to construct an empty vector. Ø STACK: Stack, followed by first-in-first-out. Ø Arraylist implements an array of variable sizes. (3) map-type set |