vendredi 27 mars 2015

Java getting certain value from a hashmap



code



HashMap <String, Integer> polllist = new HashMap<>();
public boolean onCommand(CommandSender s, Command Cmd, String label, String[] args)
{

}


So I made a HashMap containing a String and an Integer. I tried doing this.



if(polllist.containsValue(args[1]))
{

}


This does not seem to work, I put an else statement and that always triggers when I know I put a value in the hashmap that equals args[1]. I am trying to find the integer value but it does not seem to work. How would I also get the string value.




Aucun commentaire:

Enregistrer un commentaire