当对前往的list举行遍历的时分,用户必需手动地对其举行同步:不遵守该倡议的话大概会招致没法预知的举动复制代码
- Listlist=Collections.synchronizedList(newArrayList());...synchronized(list){Iteratori=list.iterator();//Mustbeinsynchronizedblockwhile(i.hasNext())foo(i.next());}
欢迎光临 仓酷云 (http://ckuyun.com/) | Powered by Discuz! X3.2 |