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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -