Java generic methods in generics classes
问题 If you create a generic class in Java (the class has generic type parameters), can you use generic methods (the method takes generic type parameters)? Consider the following example: public class MyClass { public <K> K doSomething(K k){ return k; } } public class MyGenericClass<T> { public <K> K doSomething(K k){ return k; } public <K> List<K> makeSingletonList(K k){ return Collections.singletonList(k); } } As you would expect with a generic method, I can call doSomething(K) on instances of