eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Primitive non-mutable/immutable map interfaces should not expose mutable methods

Open victornoel opened this issue 3 years ago • 0 comments

As discovered by @donraab in https://github.com/eclipse/eclipse-collections/issues/740#issuecomment-639645017, there seems to be an error in base interface for the primitive maps.

For example, in IntIntMap, we find this method:

    /**
     * Returns a set containing all the keys in this map. The set is backed by the
     * map, so any modifications to the returned set will affect this map.
     * @return a mutable set containing the keys in this map
     */
    MutableIntSet keySet();

We would expect that it returns IntSet only, and that the sub-interface take care of overriding with the correct type.

victornoel avatar Apr 02 '22 17:04 victornoel