The Java.util.EnumMap.containsKey(key) method is used to check whether a specified key mentioned in the parameter is present in this map or not.
boolean containsKey(Object key)
Parameter: The method accepts one parameter key which refer to the key to be verified.
Return Value: The method returns true if the key is present in the EnumMap otherwise it returns false.
Below programs illustrate the containsKey() method:
gfg_visitors from United States: true
gfg_visitors from Russia: false
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- HashSet vs TreeSet in Java
- ShortBuffer allocate() method in Java With Examples
- IntBuffer duplicate() method in Java with Examples
- ShortBuffer compact() method in Java With Examples
- LongBuffer equals() method in Java
- IntBuffer array() method in Java
- IntBuffer hasArray() method in Java
- ShortBuffer arrayOffset() method in Java With Examples
- ShortBuffer asReadOnlyBuffer() method in Java with Examples
- ByteBuffer asDoubleBuffer() method in Java with Examples