[英]What is corresponding method to StringUtils.defaultIfEmpty() but for LocalDate?
private ClientIdentifier(final Client client, final CodeValue documentType,
final String documentKey, final LocalDate validity,
final String description) {
this.client = client;
this.documentType = documentType;
this.documentKey = StringUtils.defaultIfEmpty(documentKey, null);
this.validity = LocaleUtils.defaultIfEmpty(validity,null); // I am confused in this part
this.description = StringUtils.defaultIfEmpty(description, null);
}
我正在傳遞LocalDate,但不知道該使用哪個實用程序來檢查defualtIfEmpty
要提供任何類型的默認值,可以使用例如Apache Commons的ObjectUtils.firstNonNull(T ...)或Guava的MoreObjects.firstNonNull(T,T) 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.