import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class MapDemo{
public static void main(String[] args){
Map<Integer,String> map = new HashMap<Integer,String>();
method(map);
}
public static void method(Map<Integer,String> map){
map.put(8, "王五");
map.put(2, "赵六");
map.put(7, "小强");
map.put(6, "旺财");
Collection<String> values = map.values();
Iterator<String> it = values.iterator();
while(it.hasNext()){
System. out.println(it.next());
}
}
}
谁能说说values方法是干嘛的??
|
|