3 ms·
> This means that if text2 is null, the replace() method call is ignored and no NullPointerException is thrown. I don't understand why this is preferable.
by serge2k 12y ago
> This means that if text2 is null, the replace() method call is ignored and no NullPointerException is thrown.
I don't understand why this is preferable.
- tjdetwiler 12y agoIt's intended to be shorthand for: if (text2 != null) { text2.replace() } Essentially they're moving support for @Nullable and @NotNull into the language and compiler. https://www.jetbrains.com/idea/documentation/howto.html https://www.jetbrains.com/idea/documentation/howto.html