使用equals避免int值比较错误

This commit is contained in:
achao 2022-06-22 17:17:37 +08:00 committed by VampireAchao
parent d6118fe057
commit 173211eaef

View File

@ -108,7 +108,7 @@ public class Opt<T> {
* @since 5.7.17
*/
public static <T, R extends Collection<T>> Opt<R> ofEmptyAble(final R value) {
return CollUtil.isEmpty(value) || Collections.frequency(value, null) == value.size() ? empty() : new Opt<>(value);
return CollUtil.isEmpty(value) || Objects.equals(Collections.frequency(value, null), value.size()) ? empty() : new Opt<>(value);
}
/**