-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.java
More file actions
26 lines (19 loc) · 768 Bytes
/
Map.java
File metadata and controls
26 lines (19 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.HashMap;
import java.util.TreeMap;
public class Map {
public static void main(String[] args) {
HashMap <String , Integer> names = new HashMap<>();
names.put("Hussin" , 1234);
names.put("Ali",1111);
names.put("koko", 50530);
System.out.println(names);
System.out.println(names.get("Hussin"));
System.out.println(names.containsKey("Ali"));
System.out.println(names.containsValue(000001));
names.put("koko", 122332);
System.out.println(names);
names.replace("koko", 90000);
System.out.println(names);
}
}
//Welche Map Implementierungen gibt es in Java, nenne die zwei bekanntesten? TreeMap und Hashmap