Skip to main content
added 24 characters in body
Source Link
Konstantin Yovkov
  • 63k
  • 9
  • 107
  • 152

When you have questions like these in the future, just FYI, google Java HashMap...you get a list of alltry to find the methods for hashmapsHashMap javadoc and can then you will be able to determine very quickly for yourself what to use. 

In this case you wouldcan use containsKey()

  Java containsKeyHashMap#containsKey(java.lang.Object) method

  or if you want to find if the value inis in the hashmapHashMap, you can use containsValue()

Java containsValueHashMap#containsValue(java.lang.Object) method.

When you have questions like these in the future, just FYI, google Java HashMap...you get a list of all the methods for hashmaps and can then determine very quickly for yourself what to use. In this case you would use containsKey()

Java containsKey() method

  or if you want to find if the value in in the hashmap, use containsValue()

Java containsValue() method

When you have questions like these in the future, try to find the HashMap javadoc and then you will be able to determine very quickly what to use. 

In this case you can use   HashMap#containsKey(java.lang.Object) or if you want to find if the value is in the HashMap, you can use HashMap#containsValue(java.lang.Object).

Source Link
Josh Engelsma
  • 2.6k
  • 16
  • 17

When you have questions like these in the future, just FYI, google Java HashMap...you get a list of all the methods for hashmaps and can then determine very quickly for yourself what to use. In this case you would use containsKey()

Java containsKey() method

or if you want to find if the value in in the hashmap, use containsValue()

Java containsValue() method