1. class Solution {
    2. public List<Integer> inorderTraversal(TreeNode root) {
    3. List<Integer> result = new ArrayList<>();
    4. addValue(result,root);
    5. return result;
    6. }
    7. private void addValue(List<Integer> result,TreeNode root){
    8. if(null == root){
    9. return;
    10. }
    11. if(null != root.left){
    12. addValue(result,root.left);
    13. }
    14. result.add(root.val);
    15. if(null != root.right){
    16. addValue(result,root.right);
    17. }
    18. }
    19. }