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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -