Implement the generic method to add element in a list.