Map取值

一、 Java 容器
   1. Map取值
方法一.    Set keys = map.keySet( );    if(keys != null) {
       Iterator iterator = keys.iterator( );
       while(iterator.hasNext( )) {
          Object key = iterator.next( );
          Object value = map.get(key);
           ....
       }
    }
方法二. 用entrySet()
    Iterator it = emails.entrySet().iterator();  
    while(it.hasNext()){  
        Map.Entry m=(Map.Entry)it.next();  
    }
方法三:用keySet()  
    Iterator it = emails.keySet().iterator();  
        while (it.hasNext()){  
        String key;  
        key=(String)it.next();       }  

你可能感兴趣的:(java)