I have a use case where I'd like to use opaque byte[] as keys into a MapDb. I discovered this - Using a byte array as Map key - limitation quickly; and wonder which approach is recommended.
I'd rather not create a bunch of interim objects and serialization overhead, but it seems like ByteBuffer.wrap(my_bytes)
is where Java is pointing me.
I'm hoping one of the core devs of MapDB can weigh in on this or a ByteBuffer
JVM guru.
MapDB author here.
It is possible to use byte[] without wrappers. There is Hasher which handles hashCode and equals methods for HTreeMap:
Map map = db.createHashMap("map")
.hasher(Hasher.BYTE_ARRAY)
.keySerializer(Serializer.BYTE_ARRAY)
.makeOrGet();