测试java.util.Map.Entry

阅读更多

 

/**

 * Copyright (c) 2011 Trusted Software and Mobile Computing(TSMC)

 * All rights reserved.

 * Author: Jarg Yee

 * http://jarg.iteye.com/

 */

import java.util.Map;

import java.util.HashMap;

import java.util.Map.Entry;

/*

 * 测试Entry

 */

public class EntryTest

{

public static void main(String[] args)

{

Map model = new HashMap();

model.put("3", "3");

model.put("1", "1");

model.put("2", "2");

model.put("7", "7");

 

System.out.println("key\tvalue");

for(Entry entry : model.entrySet())

{

System.out.println(entry.getKey() + "\t" + entry.getValue());

}

 

System.out.println("");

}

}


 

你可能感兴趣的:(测试java.util.Map.Entry)