public void retainKeys(Collection<K> keys) {
		Set<KeyedFuture<K, V>> removed = new LinkedHashSet<>();
		synchronized (this) {
			for (Iterator<Entry<K, KeyedFuture<K, V>>> it = futures.entrySet().iterator(); it
					.hasNext();) {
				Entry<K, KeyedFuture<K, V>> ent = it.next();
				if (!keys.contains(ent.getKey())) {
					removed.add(ent.getValue());
					it.remove();
				}
			}
			map.keySet().retainAll(keys);
		}
		for (KeyedFuture<K, V> f : removed) {
			f.cancel(false);
		}
	}
Retain only those entries whose keys appear in the given collection

<p>
All removed entries with pending computations will be canceled

@param keys the keys to retain
Ghidra/Framework/Generic/src/main/java/ghidra/async/AsyncLazyMap.java