Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

containskey in java

HashMap<Integer, String> hashMap = new HashMap<>(); // Create HashMap

hashMap.put(1, "one"); // Put 1 as "one" in HashMap.
hashMap.put(2, "two"); // Put 2 as "two" in HashMap.

System.out.println("Contain 1: " + hashMap.containKey(1)); // Return true.
System.out.println("Contain 2: " + hashMap.containKey(2)); // Return true.
System.out.println("Contain 3: " + hashMap.containKey(3)); // Return false.
 
PREVIOUS NEXT
Tagged: #containskey #java
ADD COMMENT
Topic
Name
8+9 =