Specify erasure for type T:
public <T> T last(List<T> list) {...}
Create a free account to access the full topic