map 不是并发安全的
官方的faq里有说明,考虑到有性能损失,map没有设计成原子操作,在并发读写时会有问题。
Map access is unsafe only when updates are occurring. As long as all goroutines are only reading—looking up elements in the map, including iter
class Toilet<T> {
public void enter(T t) {
}
}
class Male {
}
class Female {
}
public class Demo {
public static void main(String[] args) {
Toilet<Male> mansroom = new Toilet();
Toilet<