SimpleBindings containsKey() method in Java with Examples
The containsKey() method of SimpleBindings class is used to return true if this map which is backing this SimpleBindings object contains a mapping for the specified key. If SimpleBindings object contains this key then the method returns true else false.
public boolean containsKey(Object key)
Parameters: This method accepts only one parameters key which is key whose presence in this map is to be tested.
Return Value: This method returns true if this map contains a mapping for the specified key.
Exception: This method throws following exceptions:
- NullPointerException: if key is null
- ClassCastException: if key is not String
- IllegalArgumentException: if key is empty String
Java programs to Illustrate the working of containsKey() method:
England exits in Asia Team:false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.