private void printFirstSequence(TreeNode root){ LinkedList<TreeNode> queue = new LinkedList<>(); queue.add(root); while (!queue.isEmpty()){ TreeNode node = queue.poll(); System.out.println(node.val); if (node.left!=null){ queue.add(node.left); continue; } if (node.right!=null){ queue.add(node.right); } } }