Skip to content

functional interface

upan edited this page Jul 13, 2016 · 7 revisions

Java8 函数式接口

概述

Runnable 执行一个没有参数和返回值的操作

@FunctionalInterface
public interface Runnable {
    public abstract void run();
}

Supplier 提供一个 T 类型的值

··· @FunctionalInterface public interface Supplier {

/**
 * Gets a result.
 *
 * @return a result
 */
T get();

} ···

Clone this wiki locally