Eliezer
Eliezer

Reputation: 7347

Android Future vs FutureTask

Is there any reason to use one over the other? They seem to both do the same thing in different ways. I can see that FutureTask is more extensible, but for a simple task where I want to return a future to get a value from later, is there a difference?

Upvotes: 0

Views: 2757

Answers (1)

ILovemyPoncho
ILovemyPoncho

Reputation: 2792

I don't think there is a real benefit of the default implementation of FutureTask. I think the benefit comes when you extend it and override the callback methods according to you requirements.

If you use the default implementation of FutureTask, wrapping a Callable when sending a new task using ExecutorService's execute(). As this guy says, it's like wrapping a FutureTask with another FutureTask.

Upvotes: 3

Related Questions