I'm having trouble inserting objects to an ArrayList within a switch statement. Before entering the switch, the add function works fine. Here's the code:
Can anyone advise me as to why the add command within the switch statement isn't working and what to do to make it work?
Nothing gets added to the ArrayList... the size doesn't increase after the add statement within the switch and the values added don't show when I print out the contents of the ArrayList. Don't know how to explain it any other way... Removing parenthesis from around the case values did not fix it .
Edit: I've tried removing the switch and using an if instead, but it does not make a difference.
Edit 2: I figured out the problem was that I was instantiating the ArrayList after everytime I tried to add an appointment within the switch.
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, the permaculture playing cards