I was not sure how to write the title, but anyway. I have a method that randomly sends me objects (of emails) from 10 to 60 seconds. Now is the problem that I need to make a new method called getNewMessages, that returns a list of emails that is NEW from the last time the method is called.
So lets say that the first time I call this method it gets all the new emails (this part is not a problem), but the second time I call it, the old emails should be removed from the list and the new ones should fill the list, SINCE the last time we called the method.