How to find the value of a hashmap element?

Asked

Viewed 577 times

1

I have a very strange doubt, I have a HashMap that has these two values

ids("pergunta","IdP");

To pergunta is a String and IdP is a Int, me now to get the value of Idp I have to do int a = ids.get("IdP"); ?

1 answer

1


No, you have to look for key - which in this case is pergunta.

int a = ids.get("pergunta");
  • IdP is a Int , I went to do as you said and gave the error - The method parseint(String) in the type Integer is not applicable for the Arguments (Integer)

  • Yes I own that kind of hashmap

  • 1

    Thanks @Renan already figured out my problem with your help, I was using Idp instead of the question

Browser other questions tagged

You are not signed in. Login or sign up in order to post.