-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOurData.java
More file actions
35 lines (28 loc) · 918 Bytes
/
OurData.java
File metadata and controls
35 lines (28 loc) · 918 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
27
28
29
30
31
32
33
34
35
package com.sample;
import java.util.LinkedHashMap;
import java.util.Map;
public class OurData {
public static final Map<Integer, Contact> THE_MAP = new LinkedHashMap<>();
/** This is a bad way to do it. Not thread safe. */
static int autoinc = 0;
static {
}
public static class Contact {
public final int id;
public final String nameFirst, nameLast, email;
public Contact(int id, String nameFirst, String nameLast, String email) {
this.id = id;
this.nameFirst = nameFirst;
this.nameLast = nameLast;
this.email = email;
}
/** Default values */
public Contact() {
this.id = 0;
this.nameFirst = "";
this.nameLast = "";
this.email = "";
}
}
}