@Override
    protected void updateListAfterHit(CacheEntry<K, V> entry) {
        if (entry != null && !entry.equals(_first)) {
            if (entry.getHits() > entry.getPrevious().getHits()) {

                // Swap the positions
                final CacheEntry<K, V> beforePrevious = entry.getPrevious().getPrevious();
                final CacheEntry<K, V> previous = entry.getPrevious();
                final CacheEntry<K, V> next = entry.getNext();

                if (beforePrevious != null) {
                    beforePrevious.setNext(entry);
                } else {
                    _first = entry;
                }
                entry.setPrevious(beforePrevious);

                previous.setPrevious(entry);
                previous.setNext(next);

                entry.setNext(previous);

                if (next == null) {
                    setLast(previous);
                } else {
                    next.setPrevious(previous);
                }
            }
        }
    }
@Override
    protected void updateListAfterHit(CacheEntry<K, V> entry) {
        if (entry != null && !entry.equals(_first)) {
            if (entry.getHits() > entry.getPrevious().getHits()) {

                
                final CacheEntry<K, V> beforePrevious = entry.getPrevious().getPrevious();
                final CacheEntry<K, V> previous = entry.getPrevious();
                final CacheEntry<K, V> next = entry.getNext();

                if (beforePrevious != null) {
                    beforePrevious.setNext(entry);
                } else {
                    _first = entry;
                }
                entry.setPrevious(beforePrevious);

                previous.setPrevious(entry);
                previous.setNext(next);

                entry.setNext(previous);

                if (next == null) {
                    setLast(previous);
                } else {
                    next.setPrevious(previous);
                }
            }
        }
    }
@ Override protected void updateListAfterHit ( CacheEntry < K , V > entry ) { if ( entry != null && ! entry . equals ( _first ) ) { if ( entry . getHits ( ) > entry . getPrevious ( ) . getHits ( ) ) { // Swap the positions final CacheEntry < K , V > beforePrevious = entry . getPrevious ( ) . getPrevious ( ) ; final CacheEntry < K , V > previous = entry . getPrevious ( ) ; final CacheEntry < K , V > next = entry . getNext ( ) ; if ( beforePrevious != null ) { beforePrevious . setNext ( entry ) ; } else { _first = entry ; } entry . setPrevious ( beforePrevious ) ; previous . setPrevious ( entry ) ; previous . setNext ( next ) ; entry . setNext ( previous ) ; if ( next == null ) { setLast ( previous ) ; } else { next . setPrevious ( previous ) ; } } } }
Resort the linked list. If this CacheEntry has more hits than the previous one move it up.
Resort the linked list . If this CacheEntry has more hits than the previous one move it up .