I'm still very new to how Threads work in Java and I got an assignment to recreate the Exchanger class based on its functionality.
I read the documentation and I understand what it is supposed to do, but I'm still confused about how it actually works:
Whenever exchange gets called, how does it actually make the trade between threads?
- Does it put the object from its parameter in some sort of stack and returns another one that was already previously put in that stack?
- Where would that stack come from?
Thank you for your help!