我有以下代码从两个列表中读取信息,并将其放入地图中。我有接近 500 条记录,但我在地图中只看到 75 条记录。请建议我犯了什么错误:(
private static Map<MyStore, List<String>> buildCache() {
for (MyStore myStores : myStoreList) { //Contains a list of all the stores owned by me - has close to 600 stores.
for (HardwareInfo hardware : hardwareList) { //Contains a list infrastructure information of these stores - These lists only have store number in common.
if (myStores.getStoreNumber().equals(myStores.getStoreNumber())) {
myCache.put(myStores, hardware.getHardwareInfo_East()); //myCache is a static map.
myCache.put(myStores, hardware.getHardwareInfo_West());
myCache.put(myStores,hardware.getHardwareInfo_South());
myCache.put(myStores,hardware.getHardwareInfo_North());
break;
}
}
}
for(Map.Entry<MyStore, List<String>> entry:myCache.entrySet())
{
System.out.println("ENTRY IS: " +entry.getKey()+ " AND VALUE IS: " +entry.getValue());
}
return myCache;
}
}