我想知道这种实现是否正确[关闭]

问题描述 投票:0回答:0

当我尝试返回此验证结果时,vscode 出现问题,我看到视频中代码运行良好的人有所不同。

public interface CustomerRegistrationsValidator extends Function<Customer, ValidationResult> {

  static CustomerRegistrationsValidator isValid() {
    return customer -> customer.getEmail().contains("@")? ValidationResult.EMAIL_IS_NOT_VALID: ValidationResult.SUCCES;
  }

  enum ValidationResult {
    SUCCES,
    EMAIL_IS_NOT_VALID,
  }
}

“This lambda expression refers to the missing type ValidationResult” 这是我在 isValid() 中得到的错误

java inheritance interface functional-programming extends
© www.soinside.com 2019 - 2024. All rights reserved.