在Eclipse 3.7.1中使用Java 7闭包语法

Cha*_*thu 0 java eclipse java-7 eclipse-indigo

我安装了java SDK 7,我正在使用Eclipse 3.7.1 Indigo.

当我使用新的Java 7语法来定义HashMap时,它工作正常.

HashMap<Integer, Integer> hashMap = new HashMap<>();
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用闭包语法时,eclipse会抛出编译错误.这就是我想要编译的内容.

    public static <T> Collection<T> select(Collection<T> source,
                                       {T=>Boolean} predicate) {

    Collection<T> result = new ArrayList<T>();
    for (T o : source) {
        if (predicate.invoke(o)) {
            result.add(o);
        }
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)

语法错了吗?或者我做错了吗?

Jon*_*eet 9

Java 7没有闭包 - 它是Java 8的计划功能.

人们希望,这将是在Java 7中,但它并没有获得晋级.