I usually use the java.util.HashMap<K,V>
structure even for small scopes with very few inputs (up to 50). But I've been wondering if the java.util.TreeMap<K,V>
structure would not be better for this situation, taking into account that HashMap
is implemented over a hashtable where hashing is potentially costly in terms of processing time? Since TreeMap
is implemented on tree and does operations with pointers, which would potentially lead to better performance (writing / reading time).
Does that make sense? For simplicity we can consider applications without competition.