A friend of mine was recently asked this question in an interview.Lets say there is a continuous stream of incoming events E1, E2 each with timestamp of entry associated with them.  Write a java module to Make a call to  raiseAlert() if at any point of time there are more than 1000 elements incoming at the same time. Remember its a continuous stream. Assume there is a getnextevent() to process incoming eventsWhat ds would best suit (he said queue with a monitoring on timestamps on front and rear) and how would the module look in Java?
Alert when size of continuous stream of events exceeds 1000
java;algorithms;data structures