title: Why is this implementation of a queue with two stacks immutable and thread safe?
body: <p>I've seen this way of implementing a queue with two stacks: <a href="https://stackoverflow.com/a/2050402/494094">https://stackoverflow.com/a/2050402/494094</a></p>
  
  <p>And I've read that this way the queue is immutable and thread-safe. What's the point that separates this from a normal queue and makes it immutable and thread-safe?</p>
  
  <p>I'd really appreciate it if someone could explain it in a simple, non-professional way.</p>