Java ConcurrentHashMap and for each loop

后端 未结 2 1199
离开以前
离开以前 2021-01-23 05:52

Supposed I have the following ConcurrentHashMap:

ConcurrentHashMap identificationDocuments = new ConcurrentHashMap

        
2条回答
  •  囚心锁ツ
    2021-01-23 06:13

    I don't know If you are really asking this, but to iterate over any map you iterate over the keySet()

    StringBuffer result = new StringBuffer("");
    
    for(Integer i: indentificationDocuments.keySet()){
            result.append(indentificationDocuments.get(i));
    }
    
    return result.toString();
    

提交回复
热议问题