which interface does hashmap implement in java

Solutions on MaxInterview for which interface does hashmap implement in java by the best coders in the world

showing results for - "which interface does hashmap implement in java"
Miranda
11 May 2019
1package MyPackage;
2 
3import java.util.*; 
4 
5class HashMapExample {
6      
7    public static void main(String[] args) {
8            Map< String, Integer> courses = new HashMap< String,Integer>();
9      
10            // Add some courses.
11            courses.put("Java Courses", new Integer(6));
12            courses.put("Cloud Courses", new Integer(7));
13            courses.put("Programming Courses", new Integer(5));
14            courses.put("Data Science Courses", new Integer(2));
15      
16            System.out.println("Total courses: " + courses.size());    
17             
18            Set< Map.Entry< String,Integer> > st = courses.entrySet();    
19             
20            for (Map.Entry< String,Integer> me :st) 
21            { 
22                System.out.print(me.getKey()+":"); 
23                System.out.println(me.getValue()); 
24            } 
25            System.out.println();
26      
27            String searchKey = "Java Courses";
28            if (courses.containsKey(searchKey))
29                System.out.println("Found total " + courses.get(searchKey) + " " + searchKey);
30      
31        }
32    }
33