private final void clearUnreferencedEntries ( ) { for ( WeakEntry entry = ( WeakEntry ) queue . poll ( ) ; entry != null ; entry = ( WeakEntry ) queue . poll ( ) ) { WeakEntry removedEntry = ( WeakEntry ) super . remove ( entry . key ) ; // The entry for this key may have been replaced with another one after it was dereferenced. // Make sure we removed the correct entry. if ( removedEntry != entry ) { super . put ( entry . key , removedEntry ) ; } } // for... }
Remove the unreferenced Entries from the map .