Merge "Add a peekOldestValue"

This commit is contained in:
John Reck 2014-04-14 20:17:53 +00:00 committed by Android (Google) Code Review
commit 8af196c1f5

View file

@ -48,6 +48,7 @@ public:
bool remove(const TKey& key);
bool removeOldest();
void clear();
const TValue& peekOldestValue();
class Iterator {
public:
@ -179,6 +180,14 @@ bool LruCache<TKey, TValue>::removeOldest() {
return false;
}
template <typename TKey, typename TValue>
const TValue& LruCache<TKey, TValue>::peekOldestValue() {
if (mOldest) {
return mOldest->value;
}
return mNullValue;
}
template <typename TKey, typename TValue>
void LruCache<TKey, TValue>::clear() {
if (mListener) {