app/src/main/java/com/yahala/ImageLoader/cache/util/LruCache.java
/**
     * @param maxSize the maximum size of the cache before returning. May be -1 to evict even 0-sized elements.
     */
@param maxSize the maximum size of the cache before returning. May be -1 to evict even 0-sized elements.
@param maxSize the maximum size of the cache before returning . May be - 1 to evict even 0 - sized elements .
private void trimToSize(int maxSize) {
        while (true) {
            K key = null;
            V value = null;
            synchronized (this) {
                if (size < 0 || (map.isEmpty() && size != 0)) {
                    throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
                }
                if (size <= maxSize) {
                    break;
                }
                if (map.entrySet().iterator().hasNext()) {
                    Map.Entry<K, V> toEvict = map.entrySet().iterator().next();
                    if (toEvict == null) {
                        break;
                    }
                    key = toEvict.getKey();
                    value = toEvict.getValue();
                    map.remove(key);
                    size -= safeSizeOf(key, value);
                    evictionCount++;
                }
            }
            entryRemoved(true, key, value, null);
        }
    }
private void trimToSize ( int maxSize ) { while ( true ) { K key = null ; V value = null ; synchronized ( this ) { if ( size < 0 || ( map . isEmpty ( ) && size != 0 ) ) { throw new IllegalStateException ( getClass ( ) . getName ( ) + ".sizeOf() is reporting inconsistent results!" ) ; } if ( size <= maxSize ) { break ; } if ( map . entrySet ( ) . iterator ( ) . hasNext ( ) ) { Map . Entry < K , V > toEvict = map . entrySet ( ) . iterator ( ) . next ( ) ; if ( toEvict == null ) { break ; } key = toEvict . getKey ( ) ; value = toEvict . getValue ( ) ; map . remove ( key ) ; size -= safeSizeOf ( key , value ) ; evictionCount ++ ; } } entryRemoved ( true , key , value , null ) ; } }
@param maxSize the maximum size of the cache before returning.
@param maxSize the maximum size of the cache before returning .
// Change