Refactored isAnyNextNodePresentInList into isAnyPresent.