Now we have a useful operator in salesforce to avoid the null exceptions. Use the safe navigation operator (?.) to replace null checks. it's very useful to reduce lines of code and increase test class performance.
Before Safe Operator
String profileUrl = null; if (user.getProfileUrl() != null) { profileUrl = user.getProfileUrl().toExternalForm(); }
After Safe Operator
String profileUrl = user.getProfileUrl()?.toExternalForm();
instead of 4 lines Now we can make one line for this. Code looks more readble.