3 ms·
Is it a big difference if you have ValueNotPresentException from nullable unwrap instead of NullPointerException? Oh, wait, it exists https://docs.oracle.com/j
by GoblinSlayer 2y ago
Is it a big difference if you have ValueNotPresentException from nullable unwrap instead of NullPointerException?
Oh, wait, it exists https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html https://docs.oracle.com/javase/8/docs/api/java/util/Optional...
- swiftcoder 2y agoThe big difference is that Optional has ergonomic features like .map(), .ifPresent(), .orElse(), that reduce the verbosity of repeated if blocks checking if values are present or not.
- edflsafoiewq 2y agoThe problem is basically every type is implicitly Optional and basically every operation implicitly unwraps, instead of only the cases where nullability is actually desired.