Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8af196c1 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Add a peekOldestValue"

parents 8d56ff5d 9d8707c7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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) {