AtomicLong.set(long newValue) has the following syntax.
public final void set(long newValue)
In the following code shows how to use AtomicLong.set(long newValue) method.
// w ww .j a va 2 s .com import java.util.concurrent.atomic.AtomicLong; public class Main { public static void main(String[] argv) { AtomicLong nextId = new AtomicLong(); nextId.set(12312L); System.out.println(nextId.longValue()); } }
The code above generates the following result.