I have a system with some factors, say A, B, C, and D. There can be different values of all these factors. Let us consider few values to have a better understanding.
Let's say A has 4 different values, A1, A2, A3, A4. B may have 3 or 5(anything, no order or logic here), similarly C and D may also have many different values.
What I have to do is keep count of is how many times a given combination occurs.
For e.g., one combination is A1, B1, C1, D1. Another may be A1, B1, C2, D1 and so on.
I need to read the count of occurrences of these combination once from a text file, and search for it when queried, and give the corresponding count. There is one more condition. There is a threshold for the count. For example, let's say the threshold is 10. If the count for (A1, B1, C1, D1) is less than 10, then I need to find the count of (A1, B1, C1, Dany), if this is less than 10, then just (A1, B1, Cany, Dany) or (A1, B1).
A trie might have been an option, but searching will take more time than hashmaps there.
Which would be the best data structure to do so in Java?
Of course, the simplest and most obvious solution is to use hashmaps. But the factors(A,B,C,D) may be ten or twenty, and may take thousands of values. Though the file where I am reading values from is updated only once a day, so updating the hashmap is not a problem, but I am not sure if storing this amount of data at once in a DS is possible or not. Also loading it into hashmaps is going to take a lot of space I guess, as we are going to store all the possible permutations in the hashmaps.
Thank you in advance for all your suggestions and efforts, much appreciated.