JAVA 遍历Map所有元素

//JDK1.5
Map  m  =  new HashMap();  
  for   (Object o  : map.keySet()){  
          map.get(o);  
  }

JDK1.4

Map map =  new HashMap()   ;  
   
  Iterator   it   =   map.entrySet().iterator()   ;  
  while   (it.hasNext())  
  {  
  Map.Entry   entry   =   (Map.Entry)   it.next()   ;  
  Object   key   =   entry.getKey()   ;  
  Object   value   =   entry.getValue()   ;  
  } 

你可能感兴趣的:(java)