public synchronized void removeLeastUsedElements ( ) { int rows = this . removePercent / 100 * this . length ; rows = rows == 0 ? 1 : rows ; while ( rows > 0 && this . length > 0 ) { // remove the last element Entry < E , T > entry = this . tail . prev ; this . tail . prev = entry . prev ; entry . prev . next = this . tail ; map . remove ( entry . key ) ; this . length -- ; rows -- ; } }
remove least used elements