중첩된 Map 사용하기.
“`java
Hashtable
for (int i = 0; i < reader.numDocs(); i++) {
Document doc = reader.document(i);
if (!pattern.containsKey(doc.get("Type"))){
pattern.put(doc.get("Type"), new Hashtable
}
if (!pattern.get(doc.get(“Type”)).containsKey(doc.get(“Sub-Type”))){
pattern.get(doc.get(“Type”)).put(doc.get(“Sub-Type”), new Hashtable
}
pattern.get(doc.get(“Type”)).get(doc.get(“Sub-Type”)).put(doc.get(“Pattern-Id”), doc.get(“Pattern”));
}
“`
개별 해시테이블을 관리할 필요가 있는 게 아니라면 익명 객체를 생성하는게 편하다.