r/learnprogramming•
[deleted]

I need help understanding why my find method writes to a file twice (Java)

[deleted]

Posted Mar 24, 2019, 8:18 PM UTC · edited

13
AutoModeratorMOD•

To all following commenters: please, do not bring up the old circlejerk jokes/memes about recursion ("Understanding recursion...", "This is recursion...", etc.). We've all heard them n+2 too many times.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1
PolyGlotCoder•

How are you calling the find method? also formatting.!

1
[deleted]•

I have another find method within the class:

public T find(T data) throws IOException
{
    countFn = 0;
    if (root == null) return null;
    else return find(d, root);
}

this is called from another class from a printDateTime method

 public String printDateTime(String dateTime) throws IOException
{
    if (avl.find(dateTime)==null) return "Date/time not found";
    else return avl.find(dateTime);
}

​

1