Posted By: dmanxiii
Which is more efficient for non-threaded applications?
Hashtableis synchronized, whereas
HashMapis not. This makes
HashMapbetter for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones.
Hashtabledoes not allow
nullkeys or values.
nullkey and any number of
One of HashMap’s subclasses is
LinkedHashMap, so in the event that you’d want predictable iteration order (which is insertion order by default), you could easily swap out the
LinkedHashMap. This wouldn’t be as easy if you were using
Since synchronization is not an issue for you, I’d recommend
HashMap. If synchronization becomes an issue, you may also look at