code for generics, lists and tuples