简体   繁体   English

功能性Java编译错误

[英]Functionaljava compilation errors

From here: http://functionaljava.googlecode.com/svn/artifacts/3.0/demo/bgga/Option_filter.java 从这里: http : //functionaljava.googlecode.com/svn/artifacts/3.0/demo/bgga/Option_filter.java

Q: Ho would I compile this example? 问:我将如何编译此示例? If no way: What the purpose to put now working examples? 如果没有办法:现在举个例子的目的是什么?

import fj.data.Option;
import static fj.data.Option.none;
import static fj.data.Option.some;
import static fj.Show.intShow;
import static fj.Show.optionShow;

public final class Option_filter {
  public static void main(final String[] args) {
    final Option<Integer> o1 = some(7);
    final Option<Integer> o2 = none();
    final Option<Integer> o3 = some(8);
    final Option<Integer> p1 = o1.filter({int i => i % 2 == 0});
    final Option<Integer> p2 = o2.filter({int i => i % 2 == 0});
    final Option<Integer> p3 = o3.filter({int i => i % 2 == 0});
    optionShow(intShow).println(p1); // None
    optionShow(intShow).println(p2); // None
    optionShow(intShow).println(p3); // Some(8)
  }
}

I don't see any chance for Java (5-7) compile this, for example: 我看不到Java(5-7)进行编译的任何机会,例如:

filter({int i => i % 2 == 0});

This example uses the proposed BGGA syntax. 本示例使用建议的BGGA语法。 Java 8 code examples are at http://www.functionaljava.org/examples-java8.html . Java 8代码示例位于http://www.functionaljava.org/examples-java8.html Your specific example is there and in the Github repo at https://github.com/functionaljava/functionaljava/blob/master/demo/src/main/java/fj/demo/Option_filter.java . 您的特定示例在那里,也位于Github存储库中, 网址https://github.com/functionaljava/functionaljava/blob/master/demo/src/main/java/fj/demo/Option_filter.java

Your code is from the old repo and website. 您的代码来自旧的存储库和网站。 Please use the new site at www.functionaljava.org and at github on github.com/functionaljava/functionaljava. 请使用新站点,网址为www.functionaljava.org和github.github.com/functionaljava/functionaljava。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM