java - Issue with interface and parameter -


i have problem interface , parameters:

public class functions {   public static double getinfosum(treemap<string, iinterface> map){     ....some counting   } }  public class exampleclass {    private treemap<string, exampleclassitem > xxxx;    public static void somefunction(){     functions.getinfosum(xxxx); //here error    } }   public class exampleclassitem implements iinterface {    .....  } 

is there other possibility except this:

private treemap<string, exampleclassitem > xxxx; -----> private treemap<string, iinterface > xxxx; 

because need work exampleclassitem there specific functions can not in interface.

you can change

public static double getinfosum(treemap<string, iinterface> map){  ....some counting } 

to

public static double getinfosum(treemap<string, ? extends iinterface> map){  ....some counting } 

this allow pass treemap<string, exampleclassitem> method.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -