遍历Map的方法

Map<String, ClientLink> clients = ClientLinkManager.getOnlineUsers();
Iterator<Entry<String, ClientLink>> iter = clients.entrySet().iterator();
while (iter.hasNext()) {
    Map.Entry<String, ClientLink> entry = (Map.Entry<String, ClientLink>) iter.next();
    //String key = entry.getKey();
    ClientLink client = entry.getValue();
    client.sendMsgToClient(msg);
}

 

你可能感兴趣的:(map)