Jesse McCullough wrote:I can see two problems. One is the recursion caused by findAllForecasts() in the loop. Easily fixed. The other is that I keep going through the loop for every element in the list, when what I need to do is check just the last one, maybe. But that poses another problem because I'm creating dates for the whole week. And that's what I've been trying to get my head around. What's the best way to check for dates and create them in this situation?
Well, the first thing is to deal with
one thing at a time.
So: fix your recursion problem. Now what happens? Maybe what you expect (ie, you "keep going through the loop for every element in the list"), but
make sure.
You might also be better off writing the code so that it only gets ONE date (ie, the
first one you're interested in) to begin with. Once you know THAT works, add the logic to get a whole week (and for that, you'll find the
Calendar.add() method very useful).
Do you get my point?
Test small things, and
make sure they work, before you start adding new ones.
HIH
Winston