Hi I am in a situation where I need to use multiple else if's and I would like to use switch statements, I have tried a lot but I am not able to do so. How can I convert the following else if's to switch?
public ApiObservables(Object o) {
if (o instanceof SitesController) {
mSitesApi = getSitesApi();
} else if (o instanceof QuestionController) {
mQuestionApi = getQuestionApi();
} //more else if's
}
I would like to do something like this:
public ApiObservables(Object o) {
switch (o) {
}
}
instanceofchecks, even if it could be done with a switch statement.