hashSet不是线程安全的验证。
package hashset;
import java.util.HashSet;
import java.util.Set;
public class HashSetDemo {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
TestHashSet set = new TestHashSet();
Thread thread1 = new Thread(set);
Thread thread2 = new Thread(set);
thread1.start();
thread2.start();//两个线程对同一个任务里面的Hashset添加数据,验证hashset不是线程安全的。