无法同时读取修改后的linkedHashMap。我怎样才能以不同的方式做同样的工作!我想做的就是这种事!
while(flag)
for(String key:hashMap.keySet())
{
if(hashMap.get(key)==false)
{
hashMap.put(key,true);
System.out.println(key+"\t\t\t:PACKAGE");
String query="select REFERENCED_NAME from ALL_DEPENDENCIES where OWNER='xyz' AND REFERENCED_OWNER='xyz' AND NAME='"+key+"' AND TYPE='PACKAGE BODY' AND REFERENCED_TYPE='PACKAGE' AND REFERENCED_NAME<>'"+key+"'";
ResultSet rs=statement.executeQuery(query);
while(rs.next()&&(rs.getString(1)!=key))
{
if((hashMap.get(rs.getString(1)) ==null) || !(hashMap.get(rs.getString(1))== true)){
hashMap.put(rs.getString(1),false);
System.out.println(rs.getString(1));
}
}
//System.out.println("NEW :"+key);
rs.close();
}
}
flag=hashMap.containsValue(false);
}
答案 0 :(得分:0)
使用了ConcurrentHashMap,问题解决了!