Ejemplo n.º 1
0
  private int getRoamingCount() {
    int count = 0;

    Monster monster = null;

    try {
      for (String key : monsters.keySet()) {
        monster = (Monster) monsters.get(key);
        if (monster.getSpawnType().equals("Roaming")) {
          count++;
        }
      }
    } catch (ConcurrentModificationException concEx) {
      // another thread was trying to modify monsters while iterating
      // we'll continue and the new item can be grabbed on the next update
    }

    return count;
  }