我这样写java代码,
private DateTime getChangedDoseEndDate(final DateTime actualTerminateDate, final DateTime discontinueDate)
{
if (actualTerminateDate == null)
{
return discontinueDate;
}
if (discontinueDate == null)
{
return actualTerminateDate;
}
else if (actualTerminateDate.isBefore(discontinueDate))
{
return actualTerminateDate;
}
else
{
return discontinueDate;
}
}
我正在尝试将其转换为 Guava 以编写单行函数。这是,我试过一个。这是对的吗 ?我还需要它转换 java 8 。
return Ordering.natural().nullsLast().min(discontinueDate, actualTerminateDate);
慕婉清6462132
相关分类