Today, i had a sparkling conversation with my friend and colleague george. He commented (among others) on the following code,
import java.util.Map;
import java.util.HashMap;

public class FooList {
	private Map<String, List<FooResult>> results;
	
	public FooList() { ... }
	
	public FooResult[] getResults() { ... }
	
	// other methods follow
}
that the FooList does not serve any purpose and i should expose the Map directly.

I think it is a bad habit to expose your containers directly as part of your application programming interface (API), or even subclassing them, unless your are creating an container. Why is that?

You do not narrow down the messages of an object, thus increasing the complexity of the overall API. In this case the Map interface has 14 methods and my class had only 7. In addition, the naming of the type FooList is self-documenting, indicating that we are storing a list of Foo. If we export the Map<String, List<FooResult>> directly, the result is not so obvious, we do not know what the String represents, and we are also exposing the type List, which is completely hidden in the first case.