6
I use the structure a lot java.util.HashMap<K,V>
even for small scopes with few inputs (up to 50). But I’ve been wondering if the structure java.util.TreeMap<K,V>
would not be better for this situation, taking into account that the HashMap
is implemented on a hashtable where the calculation of hash is potentially expensive in terms of processing time? Already the TreeMap
is implemented over a tree and does pointer operations, which would potentially lead to better performance (writing/reading time).
Does this make sense? To simplify we can consider applications without competition.