[SOLVED] Error I never seen befor!

Discussion in 'Plugin Development' started by ThaH3lper, Sep 20, 2012.

Thread Status:
Not open for further replies.
  1. Offline


  2. Offline


    Does this Hashmap object exist?
  3. You can't remove from a HashMap while looping through it except whwn you use a Iterator:
    1. Iterator<Entry<String, Integer> iter = map.entrySet().iterator;
    2. Entry<String, Integer> entry;
    3. while(iter.hasNext() { // this is row 846
    4. entry = iter.next();
    5. if (entry.getValue() == 0) {
    6. SpawnAfterZero(entry.getKey());
    7. iter.remove();
    8. ...

    Please note that I also changed your keySet() call to entySet() which gets both, the key and the value (it looks like you want both...).
  4. Offline


    Looks like it works but how do I change this? Im noob at entry and Iterator
     else {
    map.put(key, map.get(key).intValue() - 1);
    Works great! thanx (y) :D [SOLVED]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 28, 2016
Thread Status:
Not open for further replies.

Share This Page