code: public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException {
          final @Nullable SharedReference<T> localRef = getCopy();
          try {
              if (localRef == null) {
                  return f.apply(null);
              } else {
                  return f.apply(localRef.get());
              }
          } finally {
              if (localRef != null) localRef.close();
          }
      }
docs: Call some function f on a threadsafe copy of the reference we are storing.
  Should be used if you expect the function to take a while to run.
  Saving the value of T after this call returns is COMPLETELY UNSAFE.  Don't do it.
  
  @param f  lambda(T x)
  @param <Z> Return type; &lt;? extends Object&gt;
  @return result of f
  @throws IOException  if closing the local reference throws.