19-Map集合-09-常用对象API(集合框架-Map集合-LinkedHashMap&关联源码)

package cn.itcast.linkedhashmap.demo;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

public class LinkedHashMapDemo {

	public static void main(String[] args) {
		
		LinkedHashMap<Integer,String> hm= new LinkedHashMap<Integer,String>();
		
		hm.put(7, "zhouqi");
		hm.put(3, "zhangsan");
		hm.put(1, "qianyi");
		hm.put(5, "wangwu");
		
		Iterator<Map.Entry<Integer,String>> it = hm.entrySet().iterator();
		while(it.hasNext()){
			Map.Entry<Integer, String> me = it.next();
			Integer key=me.getKey();
			String value=me.getValue();
			System.out.println(key+":::"+value);
		}

	}

}

你可能感兴趣的:(19-Map集合-09-常用对象API(集合框架-Map集合-LinkedHashMap&关联源码))