As far as I know, wait()
and notify()
have been replaced with better concurrency mechanisms. So, what better alternative would you choose, say for implementing a synchronized queue?
In what sense exactly are they "better"?
Edit: This ("implement a synchronous queue") is an interview question. An acceptable answer cannot use BlockingQueue or other queue implementation. It might, however, use other synchronization constructs such as CountDownLatch. I do not have an exhaustive list of allowed and forbidden classes - use your heads.
See Question&Answers more detail:os