method with Generic types