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
Post a Comment