The collection class is stored in the Java.util package.
The collection class holds the object's reference, not the object itself, and for the convenience of expression, we say that the object in the collection refers to the reference to the object in the collection (reference).
There are 3 main types of collections: Set (Set), list (listing), and map (map).
Set: Object cannot be duplicated
The set also has multiple variants that can be sorted, such as TreeSet, which adds an object to a set of actions that will be inserted into an ordered sequence of objects according to a comparison rule. It implements the SortedSet interface, which is the method of adding object comparisons. By iterating over the objects in the set, we can get an ascending set of objects.
List: objects are stored in a linear fashion, without a specific order, with only one beginning and one end, and of course, it is different from a set that has no order at all.
The list is represented in the data structure as: array and vector, linked list, stack, queue.
Map: There is a clear difference between a map and a set or list, and each item in the map is paired. Each object stored in the map has an associated keyword (key) object that determines where the object is stored in the map, and must be supplied with the corresponding keyword when retrieving the object, as if looking up a word in the dictionary. The keyword should be unique.
The keyword itself does not determine where the object is stored, it needs to be processed over a hashing (hashing) technique, producing an integer value called a hash code, which is usually used as a bias, relative to the starting position of the memory region assigned to the map. This determines where the keyword/object pair is stored. Ideally, hash processing should result in a uniformly distributed value within a given range, and each keyword should have a different hash code.
Java collection classes