Java-Set Source Code Analysis
Set is also inherited from Collection, and set is also a set, and Set does not allow repeated elements to exist.
Set Source Code:
Public interface Set
Extends Collection
{Int size (); // boolean isEmpty (); // whether it is null boolean contains (Object o); // whether it contains an Object Iterator
Iterator (); // generates the iterator Object [] toArray (); // returns the Object Array
T [] toArray (T [] a); // returns the Generic Array boolean add (E e); // adds the element boolean remove (Object o) to the set ); // delete an element boolean containsAll (Collection
C); // whether a Collection is included in this lset boolean addAll (Collection
C); // append a Collection to this set boolean retainAll (Collection
C); // Delete the element boolean removeAll (Collection
C); // Delete the element void clear () contained in this Collection; // clear set boolean equals (Object o); // determine whether the two sets are the same int hashCode (); // calculate the hashCode @ Override default Spliterator of the set.
Spliterator () {return Spliterators. spliterator (this, Spliterator. DISTINCT );}}