What is the difference between Koloboke HashObjObj<K, V> and Java util HashMap<K, V>?
I am aware of the performance that Koloboke provides but there might be instances that K/V turn out to be a Integer/Long. Generally if known HashLongObjMap would be recommended but what happens when K/V come in as generics. From what I understand using HashLongObjMap uses long primitive as the key but what are the differences that come in when HashObjObjMap<Long, V> is used?
Eg:
HashLongObjMap<V> map1 = HashLongObjMaps.newImmutableMap();
Vs
HashObjObjMap<K, V> map2 = HashObjObjMaps.newImmutableMap();
The difference between
HashObjObjMapandjava.util.HashMapis algorithm and itnernal memory layout.HashObjObjMapis an open-addressing hash table with linear probing, storing keys and values in the same flatObject[]array, in interspersed order: [key1, value1, key2, value2, ...].Entryobjects don't exist, they are created only when required byMapAPI (i. e.entrySet()iteration).HashMapis a hash table with separate chaining, keys and values are stored in separateEntryobjects.HashLongObjMapstores keys as primitivelongs,HashObjObjMaphas ordinaryObjectkeys.HashObjObjMap<Long, V>cannot callHashLongObjMapinternally because they have slightly different contract, e. g. the latter cannot holdnullkey. Also I don't see much sense in it, if you needlongkeys you should just explicitly useHashLongObjMapyourself instead ofHashObjObjMapand relying on some implicit "optimizations".