I have the following class:
class MySelectBox {
public MySelectBox(Provider<Map<? extends Object, ? extends Object>> providerArrayIdToLabel) {
...
}
}
And I’m trying to pass this in code that uses this class:
new MySelectBox(new Provider<Map<Long, String>>{
... my implementation of Provider ...
});
The compiler gives the following error:
The constructor MySelectBox(new Provider<Map<Long,String>>(){}) is undefined
Why? Why is the method undefined? What should I change in the constructor’s signature to make it accept Provider<Map<Long, String>>
Note: the Provider interface is:
public interface Provider<T> extends javax.inject.Provider<T> {
T get();
}
Change the declaration of the MySelectBox constructor to this: