private void processQueue() {
    MyRef<T> ref;
    //noinspection unchecked
    while ((ref = (MyRef<T>)queue.poll()) != null) {
      // could potentially remove irrelevant gced MyRef entry with the same hashCode, but it's ok,
      // because the removal of that other MyRef down the queue will lead to removal of this entry `ref` later.
      set.remove(ref);
    }
  }
private void processQueue()