In my Android app, I am using Firebase Database to store the data. There are some values that I want to store in the Firebase Database as a Map<String, Integer>
.
When retrieving my data for display on the Android UI, I mostly need data "sorted by key".
My question is from a performance viewpoint whether I should declare the Map as a Hashmap or a Treemap? For e.g. like
Map<String, Integer> myData = new Hashmap<>();
or
Map<String, Integer> myData = new Treemap<>();
Of the above 2 options, which would give me a better performance for retrieval of data. Each Map size is expected to be in range of 0 to 10,000 entries. And there could be anywhere between 5-11 such Maps in my database for each user.
My question is specifically to target understanding performance of Firebase and not a general question about the difference between 2 map types.