Вопрос

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