posted 1 week ago
Welcome to CodeRanch!
Yes, you're allowed to use generic type parameters in methods. But to use them, you must first declare them.
There are two ways of declaring type parameters:
In a class header:
In a method header:
Note that generic type parameters declared in class headers can not be used in static methods. To use them, make the method non-static, or move the generic type parameters to the method signature.
In your particular case, you don't need generics at all. Just declare your method to accept arguments of type Foo.