package CH02;
import java.util.LinkedHashMap;
import java.util.Set;
public class TestLinkedMap
{
public static void main(String[] args)
{
LinkedHashMap<String, String> map=new LinkedHashMap<String, String>();
//插入键值对
map.put("akey","avalue");
map.put("bkey","bvalue");
map.put("ckey","cvalue");
map.put("dkey","dvalue");
//获取键值Set
Set<String> keySet=map.keySet();
//将键值Set转成数组
Object[] keyArray=keySet.toArray();
//按照键值依序获取值对象
for(int i=0; i<keyArray.length; i++)
System.out.println( "key="+(String)keyArray[i]+"; value="+map.get((String)keyArray[i]) );
}
}