I have the below function:
public void putList(String key, List lst){ if (T instanceof String) { // Do something
Use the instanceof operator.
That said, generic operations should be, well, generic, so be wary of changing behaviour based on type.