• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.util.concurrent.Future<capture#293 of ?>  RSS feed

 
Steven Rodeo
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Apologies if this may be too basic, not sure even if this question belongs here, but when I am trying to submit a Runnable Task, I am not sure what should be the return value.

The following code snippet, gives the following error.




found : java.util.concurrent.Future<capture#293 of ?>
required: java.util.concurrent.Future<java.lang.Runnable>
Future<Runnable> ldkdl = def.submit(new runnables(3838));
1 error


-SM
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This compiles:


 
Henry Wong
author
Sheriff
Posts: 22866
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Basically, the generic type of the future object is the type to be returned from the callable (or runnable). In the case of runnable, which doesn't have a return type, you can either use the submit() method that specifies the type, or assign it to an unknown type.... ie. Future<?>.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!