标签:
public class HashSet<E>
extends AbstractSet<E>
implements Set<E>, Cloneable, java.io.Serializable
private transient HashMap<E,Object> map;
public HashSet() {
map = new HashMap<>();
}public boolean add(E e) {
return map.put(e, PRESENT)==null;
}public boolean remove(Object o) {
return map.remove(o)==PRESENT;
}标签:
原文地址:http://blog.csdn.net/wenniuwuren/article/details/51329629