Java EnumMap containsKey() methodThe containsKey() method of Java EnumMap class is used to check whether a specified key is present in this map or not. This method returns true if this map contains a mapping for the specified key. SyntaxParameterskey - the key whose presence in this map is to be tested ReturnsThis method returns true if this map contains a mapping for the specified key. ExceptionNA Example 1Test it NowOutput: {Java=1, Python=2, PHP=3, Android=4, AngularJS=5} Tutorial.Java has a mapping: true Tutorial.PHP has a mapping: true Example 2Test it NowOutput: {Monday=1, Tuesday=2, Wednesday=3, Thursday=4} Days.Tuesday has a mapping: true Days.Thursday has a mapping: true
Next TopicJava EnumMap
|