java - List of Implementors? -
i have classes implement same java interface, allows fetching sqlite contentvalues associated particular implementor, , these classes grouped lists in various classes throughout application. have been hoping use generic list insert methods handle of these lists, ideally in manner of:
public void dosomething(list<? implements interface) { ... }
yet generics/interfaces not function way. now, do:
public void dosomething(list<? extends superclass) { ... }
if made class abstract (and set default methods throw runtimeexceptions force override sub-classes) accomplish same thing, uglier.
this not "mission critical" i'm working on, i'm curious if there smoother ways accomplish tasks.
public void dosomething(list<? extends interface> list) { ... }
with generics use extends interfaces
Comments
Post a Comment