public synchronized void setCapacity(int capacity) {
		if (capacity < 1) {
			throw new IllegalArgumentException("The capacity must be > 0!");
		}
		this.capacity = capacity;
		if (map.size() <= capacity) {
			return;
		}

		Iterator<Entry<K, CachedValue>> it = map.entrySet().iterator();
		int n = map.size() - capacity;
		for (int i = 0; i < n; i++) {
			Entry<K, CachedValue> next = it.next();
			it.remove();
			CachedValue value = next.getValue();
			valueRemoved(value.getKey(), value.getValue());
		}
	}
Sets the capacity for this cache. If this cache currently has more values than the new
capacity, oldest values will be removed.
@param capacity the new capacity for this cache
Ghidra/Framework/Generic/src/main/java/ghidra/util/timer/GTimerCache.java