how following java code work:
public class worker implements callable<myobject>{ @override public arraylist<myobject> call() throws exception { arraylist<myobject> lst_myobjects= new arraylist<myobject>(); return lst_myobjects; } }
error: return type incompatible callable.call()
i want return container of specific type (vector<>
/ arraylist<>
etc.)
just use this:
public class worker implements callable<list<myobject>>{
by using list
, can return either arraylist
or vector
, though advisable use arraylist
instead of vector
.
Comments
Post a Comment