Open nbraud opened 9 years ago
.get should also be discouraged, as it causes exceptions, which we don't accept in production code. .fold
or any of the other more specific methods or plain pattern matching or for-comprehensions should be preferred.
Yes, the part about .get
was meant for tests only. Thanks for clarifying.
Expressions such as
someOption.orNull
currently compile without compiler warning. Such expressions might yield anull
value, which will result in aNullPointerException
later on.Using
someOption.get
, which results in aNoSuchElementException
at the point of error, should be preferred.