<a href= "http://www.goodprogrammer.org/" target= "blank" >android training </a>------My Java notes and look forward to communicating with you!
1.Set interface
The set collection does not allow repeating elements, because set determines that two objects are the same not using the = = operator, but rather by the Equals method. That is, two objects cannot accept two objects by using the Equals method to return a true,set.
public class Setdemo{public static void Main (string[] args) {set<string> Set = new hashset<string> ();//Add one character String Object Set.add (New string ("ABCDE"));//Add a String object again, Set.add (new string ("ABCDE"));//The output below sees only one element of the collection System.out.println ( set);}}
2.HashSet
1) HashSet is not synchronous, multiple thread access is required to ensure synchronization through code
2) The collection element value can be null
Main methods: Principal- to-square method
Add (Object)
AddAll (Collection)
Remove (object)
RemoveAll (Collection)
Size ()
Iterator ()
ToArray ()
Clear ()
IsEmpty ()
Contain (object)
Containall (Collection)
Java Learning Collection Framework (2) < good programmer training camp >