문제

I try to index lots of words and group them in different files. I mean for each alphabet character I consider a file, like a.txt,b.txt,... My idea is this structure but I am looking for better strcucture because for each hashmap's key (word) has one file and no need to have other hashmap.

HashMap<String, HashMap<String,ArrayList<Posting>>> 

for example

 HashMap<"book", HashMap<"b.txt",ArrayList<Posting>>> 
 HashMap<"baby", HashMap<"b.txt",ArrayList<Posting>>> 
도움이 되었습니까?

해결책

Why do you need a nested hashmap? You can always conclude the file name from the word itself. Alternatively - wrap the word and file name in the object that will be used as a key in single level hashmap.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top