I'm trying to construct a nested data structure using collections and generics, and am having trouble using interfaces instead of implementations at the deeper levels. What I'd like to do is this:
but the compiler forces me to use a concrete implementation for the nested Map:
This works fine, but is there a way to use the interface instead of the implementation, in case I want to use a different one later? There's the "? extends X" syntax for subclasses, but I don't see something similar for interfaces.
Taking the question further, is there an introduction into these finer points of generics? The Sun Java Tutorial doesn't seem to go that far.