This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hey, I didn't want to ask here for help but this problem is driving me insane. Here's my code:
The code works perfectly except for one gigantic problem; the time is not removed. The program finds the two lines that are equal to one another and then goes to remove the found line but reports that it was not there, even though it just found that very line. How could that be?
Donno what's happening, but maybe you should look into Iterator.remove instead of Set.remove. Here's a quote from the Iterator.remove doc. The last sentence is a bit scary.
Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Jul 11, 2003
ah yep, seems you were right. Silly me, I thought that only ListIterator had a remove method and thus, went the route I did :-\. Thanks!