I got the following error by trying to iterate through a HashMap by a key value:
Can only iterate over an array or an instance of java.lang.Iterable
I found some answers but those use .entrySet()
and I need to iterate using a key value. This is my code so far:
for (ProtocolNode pendingNode : this.getPendingNodes().get(ExtractNumber(jid))){
// Do stuff (ExractNumber is a String)
}
And the function:
public HashMap<String, ProtocolNode> getPendingNodes()
{
return this.pending_nodes;
}
Thanks.