code: Reallocator<T> getAdaptedReallocator() {
      if (allocator == null) {
        return null;
      }
      if (metricsRecorder == null) {
        if (allocator instanceof Reallocator) {
          return (Reallocator<T>) allocator;
        }
        return new ReallocatingAdaptor<>((Allocator<T>) allocator);
      } else {
        if (allocator instanceof Reallocator) {
          return new TimingReallocatorAdaptor<>(
              (Reallocator<T>) allocator, metricsRecorder);
        }
        return new TimingReallocatingAdaptor<>(
            (Allocator<T>) allocator, metricsRecorder);
      }
    }
docs: Returns `null` if no allocator has been configured.
  Otherwise returns a `Reallocator`, possibly by adapting the configured
  `Allocator` if need be.
  If a `MetricsRecorder` has been configured, the return `Reallocator` will
  automatically record allocation, reallocation and deallocation latencies.