CurrentSkipListMap实例

package concurrent.concurrentSkipListMap;

import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListMap;
/**
 * ConcurrentSkipListMap:有序的并发map
 *
 */
public class ConcurrentSkipListMapTest {
	public static void main(String[] args) {
		ConcurrentSkipListMap<String,String> map=new ConcurrentSkipListMap<String,String>();
		map.put("BBB", "张三");
		map.put("AAA", "李四");
		map.put("ZZZ", "王五");
		map.put("HHH", "小明");
		map.put("UUU", "赵六");
		map.put("SSS", "波七");
		Set<String> set=map.keySet();
		Iterator<String> it=set.iterator();
		while(it.hasNext()){
			String key=it.next();
			String value=map.get(key);
			System.out.println(key+":"+value);
		}
	}
}

你可能感兴趣的:(CurrentSkipListMap实例)