Name: Daren Cristian M.
Morales Date: 12/11/2021
08 Activity 1
Data Structures & Algorithm
1.Create an empty hash map named programs that will handle keys and values that are
both of String type.
Java Statement:
HashMap <String, String> programs = new HashMap <String, String>();
2.Map the following pairs:
a. BSIT – Bachelor of Science in Information Technology
Java Statement:
programs.put(“BSIT”, “Bachelor of Science in Information Technology”);
b. BSCS – Bachelor of Science in Computer Science
Java Statement:
programs.put(“BSCS”, “Bachelor of Science in Computer Science”);
c. BSIS – Bachelor of Science in Information Systems
Java Statement:
programs.put(“BSIS”, “Bachelor of Science in Information Systems”);
3.Display the keys in a single line.
Java Statement:
for (Map.Entry e : programs.emptySet()); {
System.out.println(e.getKey() + “: “ + e.getValue());
}
4.Delete the first entry.
Java Statement:
programs.remove(“BSIT”);
5.Check whether the map contains the key "BSCpE"
System.out.println(programs.containsKey(“BSCpE”);