java.util.Objects.requireNonNullElse()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(265)

本文整理了Java中java.util.Objects.requireNonNullElse()方法的一些代码示例,展示了Objects.requireNonNullElse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.requireNonNullElse()方法的具体详情如下:
包路径:java.util.Objects
类名称:Objects
方法名:requireNonNullElse

Objects.requireNonNullElse介绍

暂无

代码示例

代码示例来源:origin: blynkkk/blynk-server

public UserKey(String email, String appName) {
  this.email = email;
  this.appName = Objects.requireNonNullElse(appName, AppNameUtil.BLYNK);
}

代码示例来源:origin: io.github.factoryfx/data

public String internal_getDecimalFormatPattern() {
  return Objects.requireNonNullElse(decimalFormatPattern,"#,#");
}

代码示例来源:origin: io.github.factoryfx/data

@JsonIgnore
protected CopySemantic getCopySemantic(){
  return Objects.requireNonNullElse(copySemantic, CopySemantic.COPY);
}

代码示例来源:origin: com.javax0.geci/javageci-tools

/**
 * Get a parameter. The implementation looks through the underlying map array or compound parameters array in the
 * order they were specified in the constructor. If the key is not found then {@code ""} is returned.
 * <p>
 * The key "id" is handled in a special way. In case there is no "id" defined in the parameters then the
 * identifier of the parameter set is returned.
 *
 * @param key the name of the parameter.
 * @return the parameter or {@code ""} if the parameter is not defined. In case the key is {@code "id"} and is
 * not defined in the underlying array then the parameter set identifier is returned.
 */
public String get(String key) {
  return Objects.requireNonNullElse(get0(key), "");
}

相关文章