If you simply have a K, that can apply to any type. You could add something like a List, which is a bad idea because Lists are mutable and you want immutable objectas as the “K” for a Map. But if you put a List in the Map, it doesn't implement Comparable, so that won't work. You want to assure the compiler that you will only put Comparable objects into the tree, so change its declaration toBy the way, a Comparable object may not implement Comparable to itself. So it might Comparable to its superclass, which you have to allow for. The usual declaration for Comparable is
Foo<T extends Comparable<? super T>> The second type parameter in a Map is usually V not T.