-
If you are writing a public-facing API and that immutability is an important aspect of your design, I would definitely make it explicit either by having the name of the method clearly denotes that the returned map will be immutable or by returning the concrete type of the map. Mentioning it in the javadoc is not enough in my opinion.
Since you’re apparently using the Guava implementation, I looked at the doc and it’s an abstract class so it does give you a bit of flexibility on the actual, concrete type.
-
If you are writing an internal tool/library, it becomes much more acceptable to just return a plain
Map. People will know about the internals of the code they are calling or at least will have easy access to it.
My conclusion would be that explicit is good, don’t leave things to chance.