Training 9.2. Cluster, Collection Interface

A Class Set

Class set is actually a dynamic array of objects, and the general array of different objects, classes focus on the contents of the object can be arbitrarily expanded.

 

II. Collections, collection interfaces

Collections stored in java.util package.
Reference collections are stored in the object, not the object itself, for convenience of expression, we call the object refers to a collection of objects in a reference ( Reference).
Collection types are three kinds: set (set), list (list) and a map (map). --Collection sub-interfaces, sub-categories.

Set of interface is divided into: Collection and Map, list, set implement Collection interface.

 

 

 

 

 

 

 

 Defined three .Collection interface

Collection is the largest single-parent interface to save the value of the collection.

Collection interface definition: public interface Collection <E> extends Iterable <E>

Although the significance of the Collection interface operation is the largest set of interfaces, but if the direct operation using the Collection interface, then it means is not clear, so in JAVA development has not directly advocate the use of the Collection interface,

 

Four main sub-interfaces are as follows:

List Interface: can store duplicate content.

Set interface: You can not store duplicate content, duplicate content is by all hashCode () and equals () method to distinguish between the two.

Queue: Queue Interface, characterized FIFO.

SortedSet Interface: can sort the data set.

 

Guess you like

Origin www.cnblogs.com/xtxt1127/p/11449519.html