Per comments on the question, you are asking about a style recommendation from your IDE, related specifically to:
if (myRoot == null) return myRoot;
Your IDE means that when that particular return
statement is executed, myRoot
is always null
. It is obvious that this is so, because the if
ensures that otherwise, that return
is not executed. Your IDE is recommending that you change that to
if (myRoot == null) return null;
Whether you do so is up to you, but personally, I would go with your IDE’s advice, because it makes the code slightly clearer.