public HttpCacheEntry copy(final HttpCacheEntry entry) {
        if (entry == null) {
            return null;
        }
        return new HttpCacheEntry(
                entry.getRequestInstant(),
                entry.getResponseInstant(),
                entry.getRequestMethod(),
                entry.getRequestURI(),
                headers(entry.requestHeaderIterator()),
                entry.getStatus(),
                headers(entry.headerIterator()),
                entry.getResource(),
                entry.hasVariants() ? new HashSet<>(entry.getVariants()) : null);
    }
Creates a copy of the given {@link HttpCacheEntry}. Please note the underlying
{@link Resource} is copied by reference.
httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntryFactory.java