Map inside Map:
Base.java:
Initialization:
public
static Map<String, Map<String, String>> roles = new
HashMap<>();
public
static String SCHOOL = "school";
public
static String HOSPITAL = "hospital";
Call from method:
this.createRoleMap();
Implementation:
private void createRoleMap() {
Map<String,
String> hospital = new HashMap<>();
hospital.put("admin",
"Admin");
hospital.put("physician",
"Physician");
hospital.put("nurse",
"Nurse");
hospital.put("fieldtechnician",
"Field Technician");
hospital.put("staff",
"Nurse");
roles.put(HOSPITAL,
hospital);
Map<String,
String> school = new HashMap<>();
school.put("admin",
"Admin");
school.put("physician",
"Staff Member");
school.put("nurse",
"Staff Member");
school.put("fieldtechnician",
"Staff Member");
school.put("staff",
"Staff Member");
roles.put(SCHOOL,
school);
}
No comments:
Post a Comment