Firstly, thanks for using Eclipse Collections! Currently, the best way to convert a MutableMap
to ObjectDoubleMap
is by iterating using forEachKeyValue()
and putting the key, value to an empty MutableObjectDoubleMap
MutableMap<String, Double> stringDoubleMutableMap = Maps.mutable.with("1", 1.0, "2", 2.0);
MutableObjectDoubleMap<String> targetMap = ObjectDoubleMaps.mutable.empty();
stringDoubleMutableMap.forEachKeyValue((key, value) -> targetMap.put(key, value));
In the future we can look at adding an API which will make the conversion from RichIterable<BoxedPrimitive>
to PrimitiveIterable
easier.
Feel free to open issues on Eclipse Collections GitHub Repo with the API which you would like to have. This helps us track feature requests by our users. Eclipse Collections is open for contributions as well, feel free to contribute the API which you would like: Contribution Guide.
Updated answer from comments, the lambda can be simplified to a method reference:
stringDoubleMutableMap.forEachKeyValue(targetMap::put);
Note: I am a committer on Eclipse Collections.