0
在Java中,如何使未同步集合成为同步集合?如何同步Java中的未同步集合
在Java中,如何使未同步集合成为同步集合?如何同步Java中的未同步集合
使用静态Collections.synchronizedCollection
方法:
Collection<Integer> myNumbers = Collections.synchronizedCollection(new ArrayList<Integer>());
myNumbers.add(5);
myNumbers.add(10);
调用'Collections.synchronizedCollection'? –