java - Differences between HashMap and Hashtable? -
what differences between hashmap , hashtable in java?
which more efficient non-threaded applications?
there several differences between hashmap , hashtable in java:
hashtablesynchronized, whereashashmapnot. makeshashmapbetter non-threaded applications, unsynchronized objects typically perform better synchronized ones.hashtablenot allownullkeys or values.hashmapallows 1nullkey , number ofnullvalues.one of hashmap's subclasses
linkedhashmap, in event you'd want predictable iteration order (which insertion order default), swap outhashmaplinkedhashmap. wouldn't easy if usinghashtable.
since synchronization not issue you, i'd recommend hashmap. if synchronization becomes issue, may @ concurrenthashmap.
Comments
Post a Comment