Software Package java. util
Contains collection frameworks, legacy collection classes, event models, date and time facilities, internationalization and a variety of Utility Classes (string tag generator, random number generator, and Bit Array ).
Comparison:
-
public interface Map<K,V>
Objects that map keys to values. A ing cannot contain duplicate keys. Each key can map only one value at most.
Public interfaceList <E>
Extends collection <E>
Ordered collection (also knownSequence). Users of this interface can precisely control the insert position of each element in the list. You can access the element based on the integer index (position in the list) of the element and search for the element in the list.
Unlike set, the list usually allows repeated elements. More formally, a list usually allowsE1.equals (E2)Element pairE1AndE2And if the List itself allows null elements, they usually allow multiple null elements. It is inevitable that some people want to disable the duplicate list by throwing a running exception when the user tries to insert duplicate elements. But we hope that the less this usage, the better.
ListInterface inIterator,Add,Remove,EqualsAndHashcodeSome other conventions are added to the method agreement, which exceedsCollectionThe Conventions specified in the API. For convenience, the declaration of other inheritance methods is also included here.
-
public interface Set<E>
-
Extends collection <E>
A collection that does not contain repeated elements. More formally, set does not containe1.equals(e2)
Element paire1
Ande2
And can contain at most one null element. As its name implies, this interface imitates the mathematicalSetAbstract.
In all constructor methods andAdd,EqualsAndHashcodeProtocol,SetOther rules are added to the interface.CollectionThe content inherited by the API. For convenience, it also includes declarations of other inheritance methods (these declaration specifications have been specifically designedSetThe API has been modified, but it does not contain any other rules ).