@Override
    public boolean clearExpired(final Instant instant) {
        if (instant == null) {
            return false;
        }
        lock.writeLock().lock();
        try {
            boolean removed = false;
            for (final Iterator<Cookie> it = cookies.iterator(); it.hasNext(); ) {
                if (it.next().isExpired(instant)) {
                    it.remove();
                    removed = true;
                }
            }
            return removed;
        } finally {
            lock.writeLock().unlock();
        }
    }
Removes all of {@link Cookie cookies} in this HTTP state that have expired by the specified
{@link Instant date}.

@return true if any cookies were purged.
@see Cookie#isExpired(Instant)
@since 5.2
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/BasicCookieStore.java