MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / evictLeastFrequent

Method evictLeastFrequent

java/0460-lfu-cache.java:61–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 private void evictLeastFrequent() {
62 LinkedHashSet<Entry> minFreqEntries = freqMap.get(minFreq);
63 Entry toRemove = minFreqEntries.iterator().next();
64 minFreqEntries.remove(toRemove);
65 if (minFreqEntries.isEmpty()) {
66 freqMap.remove(minFreq);
67 }
68
69 entries.remove(toRemove.key);
70 }
71}

Callers 1

putMethod · 0.95

Calls 4

getMethod · 0.45
nextMethod · 0.45
removeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected