Java function with list of classes implementing interface as argument

Multi tool use


Java function with list of classes implementing interface as argument
I have a list of classes which implement a certain interface:
List<Class<? extends DatabaseField>> models = new ArrayList<Class<? extends DatabaseField>>();
I would like to pass this list to a function which iterates over that list, and uses one or two interface functions.
What would the function signature look like?
I have tried things such as:
public static void <List<Class<T implements DatabaseField>> myMethod(List<Class<T>> myList)
And am not sure how to proceed.
public static void myMethod(List<Class<? extends DatabaseField>> myList)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What's wrong with
public static void myMethod(List<Class<? extends DatabaseField>> myList)
? Though, it's unclear how you actually intend to use this list in the first place. Maybe you should include an example of what you're trying to do.– VeeArr
2 mins ago