private synchronized void addElementToGhostList(
      K key, int accessCount, ArrayListType evictionType) {
    if (evictionType == ArrayListType.LFU) {
      mLeastFrequentlyUsedKeysGhostList.addPair(key, accessCount);
    } else {
      if (mMostFrequentlyUsedKeysGhostList.size() == mGhostListMaxSize) {
        mMostFrequentlyUsedKeysGhostList.remove(0);
      }
      mMostFrequentlyUsedKeysGhostList.add(key);
    }
  }
Adds a key to the ghost list and removes the eldest elemenet if the size of the list is bigger
than mGhostListMaxSize
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/AbstractAdaptiveCountingMemoryCache.java