Please review the following code. Methods getFirsts
and getSeconds
return a list of objects which implement CommonInterface
and both of them are private. Is it a good or bad design.
@Override
public final List<? extends CommonInterface> getObjects(final CommonEnum type) {
if (type == null) {
return new ArrayList<CommonInterface>();
}
switch (type) {
case FIRST:
return getFirsts();
case SECOND:
return getSeconds();
default:
return null;
}
}
null
an acceptable value fortype
? It would help to have a concrete example with how you use this idiom. – David Harkness Oct 20 '12 at 4:32