Iterator<Player> iterator = plugin.inreview.keySet().iterator();
while (iterator.hasNext()) {
Player key = (Player) iterator.next();
chat.getRecipients().remove(key);
}
This throws an: java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$EntryIterator.next(Unknown Source)
at java.util.HashMap$EntryIterator.next(Unknown Source)
Any ideas as to why this is happening? When this occurs, there is one key (with one value) in the map.
chat.getRecipientsandplugin.inreview?chat.getRecipientsreturns the list of players that will be messaged...this.plugin.inreviewis a Hashmap with a key and a value.chat.getRecipients().remove(key);just for test and run it do you still get this error. I think there is a relationship and you are removing elements from same collection while iterating.