The dashed box represents the interface, the solid wireframe represents the entity class, The thick wireframe represents the most commonly used entity classes, the dashed arrows indicate the implementation of the interface, and the implementation arrows indicate that the class can make objects of the class that the arrows refer to.
- Collection: Allows only one object to be placed in each location. It includes a list of "holding a set of objects in a certain order", and a set that "only allowed to add non-repeating objects." You can add elements to the collection object using the Add () method.
- Map: A group of pair,map that appear in the form of "key key-value" also does not accept duplicate key values. You can use the put () method to add elements to a map.
The difference between collection and Collecitons: Collections is the class under Java.util, it contains a variety of static methods related to the operation of the collection, to achieve a variety of combinations of search, sequencing, thread security and other operations. Collection is the interface under Java.util, which is the parent interface of various collection structures. The interfaces that inherit from it are mainly set and list.
Regardless of which set you use, you need to define the Equals () method, but you need to define HASHCODE () only if you want to put the object in HashSet. Because HashSet is the set we usually use, we usually also need to define HASHCODE (). As a programming style, the hashcode () should also be covered while the Equals () is being written.
Interview questions organize notes series one Java container class