-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.java
More file actions
39 lines (31 loc) · 1.05 KB
/
map.java
File metadata and controls
39 lines (31 loc) · 1.05 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.petehouston.tutorial.java;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.time.chrono.ChronoLocalDate;
import java.util.*;
import java.util.Date;
import java.lang.String;
public class HelloWorld {
public static void main(String[] args) throws InterruptedException {
Map<Integer, String> map = new HashMap<>();
map.put(17,"text1");
map.put(19,"text2");
map.put(4,"text3");
map.put(19,"text4");
map.put(16,"text");
map.put(null,"text5");
for (Map.Entry<Integer, String> entry : map.entrySet()) {
System.out.println(entry);
}
// for (Map.Entry<String, Integer> entry : map.entrySet()) {
// System.out.println(entry);
// }
// Iterator<Map.Entry<String, Integer>> iterator = map.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Integer> entry = iterator.next();
// System.out.println(entry);
// }
}
}