Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does java.util.concurrent.RunnableFuture have a run() method?

As I was going through JDK 7, I found that java.util.concurrent.RunnableFuture<V> has a run method. I wonder what the significance of duplicating the same run method signature in the interface is when it already extends Runnable.

package java.util.concurrent;

public interface RunnableFuture<V> extends Runnable, Future<V> {
    /**
     * Sets this Future to the result of its computation
     * unless it has been cancelled.
     */
    void run();
}  
like image 838
Maas Avatar asked Aug 02 '14 07:08

Maas


1 Answers

It's defined in the interface so that they can attach RunnableFuture-specific JavaDoc to it. There's no technical significance.

like image 176
T.J. Crowder Avatar answered Sep 21 '22 08:09

T.J. Crowder