Java set order
In the java language, there are many different structures to organize objects. Set is one of them, which is an interface in itself, and its iterative order depends on its concrete implementation. Typical implementations include:

HashSet: Hashtable stores information by using a mechanism called hashing, and elements are not stored in a certain order;

LinkedHashSet: maintains the linked list of the collection according to the insertion order of elements, and allows iteration in the collection according to the insertion order;

TreeSet: Provides an implementation that uses a tree structure to store the Set interface. Objects are stored in ascending order, and the access and traversal time is very fast.

Extended data

Set< string & gtset = new tree set< string & gt (); ?

set . add(" f "); ?

set . add(" a "); ?

set . add(" b "); ?

set . add(" c "); ?

set . add(" d "); ?

set . add(" e "); ?

system . out . println(set);

References:

Baidu Encyclopedia (Computer Science)