I have filtered Token Stream with me. Now I need to create a Indexer for it. I am aware that HashMap get/put operations are O(1). So I will be using that for sure. The problem in deciding the best Data Structure keeping in mind the search queries on that indexer.
Asked
Active
Viewed 1,270 times
0
-
possible duplicate of [How to do map inversion with Guava with non-unique values?](http://stackoverflow.com/questions/3678601/how-to-do-map-inversion-with-guava-with-non-unique-values) – Nir Alfasi Sep 25 '14 at 01:48
1 Answers
3
The most suitable data-structure for an inverted list is the trie data structure. The problem with a hashmap is that it will allow only exact matches. The advantage of the trie data structure is that it allows for prefix matches, e.g. bring matches the prefix of bringing. A robust and efficient trie implementation in Java is the Apache commons PatriciaTrie.

Debasis
- 3,680
- 1
- 20
- 23