Когда я пересекаю HashMap, я получаю исключение NullPointerException [закрыто]
Это мой код:
<code>HashMap<String, HashSet<String>> map; ....// I didn't write those code that initial the map. System.out.println(map.entrySet().size()); // run util here is ok, I get the size of the map. for(Map.Entry<String, HashSet<String>> entry : map.entrySet()) {// here throw the exception Sytem.out.println("abc");// didn't executed, throw exception before } </code>
И я получаю исключение:
Exception in thread "main" java.lang.NullPointerException at key.test.EnwikiOutlink.main(EnwikiOutlink.java:68)
Объект карты содержит более 10000 объектов карты, я запускаю его на сервере и не могу отладить. Но когда я уменьшаю размер этой карты (до 10 000), программа работает нормально. В чем причина проблемы и решение? Спасибо!