Check key exists in Hashmap Java
In below example we are going to Check key exists in Hashmap java Syntax <span class="token function">containsKey</span><span class="token punctuation">(</span><span class="token punctuation">)</span> Copy Example import java.util.HashMap; import java.util.Map; public class KeyExistsHashMapExample { public static void main(String[] args) { Map<String, String> hashMap = new HashMap<String, String>(); hashMap.put("1", "Car"); hashMap.put("2", "Bus"); hashMap.put("3", "Train"); boolean isKeyAvaillable = hashMap.containsKey("1"); if(isKeyAvaillable) … Continue reading Check key exists in Hashmap Java
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed