Skip to content

Tag: generics

How to capture and propagate a wildcard type argument?

I have a couple of classes having identical methods, except with respect to certain parameter types: Now I’m trying to have a main class that stores a mixed list of these class objects and for each of these instances, passes info between its two methods: The List<ICls<?>> and Map<String, …

How to use one type in method?

I have two forms, one form to create user and one to update user.These forms are similiar and I want to use one type in my method,I wouldn’t like to create two methods one to create user from registerForm and second to create user from updateForm Answer Use generic method like this: Output: