i.e 'a' is present in doc 1 at 1,2,and 4 positions and in doc 2 at 2nd position. I am puzzled about how to implement hashmap for this index. I couldn't get an idea about how to implement [doc 1, (1,2,4)] as one part, and [doc2, (2)] as another part using multiple values for each key. Please help me.
posted 7 years ago
Welcome to JavaRanch
Bit difficult to know what would be best, just at a quick look, but can you put those numbers into a List<Integer>? Then you could have a Map<Something, List<Integer>>; whenever you get a new Something you can add the number to the List.
Or can you create a Location class and have a List<Location>, then Map<Something, List<Location>>?