【发布时间】:2019-10-09 03:51:10
【问题描述】:
我有一些使用流的 groovy 代码,
List<MolportEntryVerification> verificationList = molportEntries.stream()
.peek{if(i++%50 == 0){println(df.format(i/count))}}
.map({entry -> verifier.verifyEntry(entry, new Standardizer(molportConfig), new Standardizer(bciConfig))})
.collect(Collectors.toList())
引起:
捕获:groovy.lang.MissingMethodException:没有方法签名:java.util.stream.ReferencePipeline$Head.peek() 适用于参数类型:(MolportFileVerification$_run_closure1) 值:[MolportFileVerification$_run_closure1@d62472f] 可能的解决方案:peek(java.util.function.Consumer)、grep()、sleep(long)、use([Ljava.lang.Object;)、grep(java.lang.Object)、wait()
长计数 = molportEntries.stream().count();
没有错误消息。
molportEntries 是 BasicMolportEntry 的列表,是一个简单的 java 类
public class BasicMolportEntry {
public BasicMolportEntry(String molportId, String etxcId, String smiles) {
this.molportId = molportId == null ? "" : molportId;
this.etxcId = etxcId == null ? "" : etxcId;
this.smiles = smiles;
}
加上所有平常的...
有什么建议吗?
【问题讨论】:
-
您使用的是哪个 Groovy 版本?你如何编译代码?这是编译时错误还是运行时错误?
标签: groovy