er {
   private final AtomicLong sequenceNumber
     = new AtomicLong(0);
   public long next() {
     return sequenceNumber.getAndIncrement();
   </code>
 }}</pre>

 <p>It is straightforward to define new utility functions that, like
 <code>getAndIncrement</code>, apply a function to a value atomically.
 For example, given some transformation
 <pre> <code>long transform(long input)</code></pre>

 write your utility method as follows:
  <pre> <code>long getAndTransform(AtomicLong var) {
   while (true) {
  