I wanted to extend LinkedHashMultimap (Guava 16.0.1), mostly to add methods that return commonly used pre-populated maps.
public class MyMap extends LinkedHashMultimap<String, Object> {
}
But, as I learned, most Guava collections are final, and those that are not, don't expose public constructors. What are the possible reasons for this design decision? And what would be the best approach to achieve my goal? The best I can think of is to wrap Multimap methods in my class, but that is far from ideal.
EDIT:
Some users pointed to valid reasons for not allowing inheritance. To extend the questions a little bit, I would like to point out couple of things.
If inheritance is not recommended in public API, how come Java's own collection classes are not final?
Suppose I extensively use a following class:
LinkedHashMultimap<Class<? extends BaseEntity>, BiConsumer<? extends BaseEntity, ? extends Object>>
Now, that's a mouthful. If I could just:
public class ConsumerMap extends LinkedHashMultimap<Class<? extends BaseEntity>, BiConsumer<? extends BaseEntity, ? extends Object>> {
}
I could then use ConsumerMap in my code instead of that monstrosity. I believe readability alone would be reason enough to justify inheritance.