code: public boolean attemptStamp(V expectedReference, int newStamp) {
          Pair<V> current = pair;
          return
              expectedReference == current.reference &&
              (newStamp == current.stamp ||
               casPair(current, Pair.of(expectedReference, newStamp)));
      }
docs: Atomically sets the value of the stamp to the given update value
  if the current reference is {@code ==} to the expected
  reference.  Any given invocation of this operation may fail
  (return {@code false}) spuriously, but repeated invocation
  when the current value holds the expected value and no other
  thread is also attempting to set the value will eventually
  succeed.
  
  @param expectedReference the expected value of the reference
  @param newStamp the new value for the stamp
  @return {@code true} if successful