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.
Need help to decide about datastructure of my project
-
22-07-2023 - |
Domanda
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>>>
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow