1

I am trying to define HashMap< ? , String> where ? is a class object from some implementation of a given interface, P.

For example, for interface ISearchEngine, i want ? to possibly be Google.class, Yahoo.class, Bing.class, etc.

2 Answers 2

6

How about

HashMap<Class<? extends ISearchEngine>, String>
Sign up to request clarification or add additional context in comments.

Comments

0

I think you want

HashMap<? extends ISearchEngine, String>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.