@Nullable
  private synchronized ArrayList<Entry<K, V>> trimExclusivelyOwnedEntries(
      int count,
      int size,
      CountingLruMap<K, Entry<K, V>> ExclusixeEntries,
      ArrayListType evictionType) {
    count = Math.max(count, 0);
    size = Math.max(size, 0);
    // fast path without array allocation if no eviction is necessary
    if (ExclusixeEntries.getCount() <= count && ExclusixeEntries.getSizeInBytes() <= size) {
      return null;
    }
    ArrayList<Entry<K, V>> oldEntries = new ArrayList<>();
    while (ExclusixeEntries.getCount() > count || ExclusixeEntries.getSizeInBytes() > size) {
      K key = Preconditions.checkNotNull(ExclusixeEntries.getFirstKey());
      addElementToGhostList(
          key, Preconditions.checkNotNull(ExclusixeEntries.get(key)).accessCount, evictionType);
      ExclusixeEntries.remove(key);
      oldEntries.add(mCachedEntries.remove(key));
    }
    return oldEntries;
  }
Removes the exclusively owned, least recently used items until there is at most <code>count
</code> of them and they occupy no more than <code>size</code> bytes.

<p>This method returns the removed least frequently used items instead of actually closing
them, so it is safe to be called while holding the <code>this</code> lock.
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/AbstractAdaptiveCountingMemoryCache.java