title: What is the Java equivalent for C# `Interlocked.Exchange(Object, Object) : Object`?
body: <p>What is the Java equivalent for C# <code>Interlocked.Exchange(Object, Object) : Object</code>? Is there a way in Java to perform the following actions in a single atomic step <em>without lock</em>: 1) store locally the reference of a variable 2) set another reference to the same variable?</p>