Primitive maps don't seem to implement java.util.Map.
If I have a function, accepting JDK Map as an argument and now want to pass eclipse collection implementation, for example ByteObjectHashMap, what's the easiest way to do that?
it stated here, that package org.eclipse.collections.impl.map.mutable
contains implementations of the MutableMap interface. Primitive are in sub-package of mutable and I expected them to implement MutableMap, which, in turn, implements java.util.Map.
The easiest way to accomplish this today is to copy the contents of the
ByteObjectMapto aMap<Byte, Object>usingforEachKeyValue.Here is an example converting a
ByteObjectMap<String>toMap<Byte, String>.Update: The Eclipse Collections 11.1 release will have a new method on object and primitive maps called
injectIntoKeyValue. The following will be possible as a solution once it is released.It would be a reasonable contribution from the OSS community to add
Mapviews for primitive maps, but this hasn't been done yet. This is probably because it is not a trivial amount of work. When Project Valhalla is available in the JDK, it would be more reasonable for the primitive maps in Eclipse Collections to implementMap<byte, String>. This is not possible without primitive specialization over generics in Java.The package documentation you linked to refers to "Related Packages", but this is clearly something worth clarifying as I can see how it may be confusing. Thank you for pointing this out.