private boolean ableToFilter ( ) { if ( filter == null ) return false ; for ( int i = table . length ; i -- > 0 ; ) { FastHashtableEntry newContents = null , next = null ; for ( FastHashtableEntry e = table [ i ] ; e != null ; e = next ) { next = e . next ; if ( filter . shouldRetain ( e . key , e . value ) ) { e . next = newContents ; newContents = e ; } else count -- ; } table [ i ] = newContents ; } return count < threshold ; }
Avoids the need to rehash when some entries can be filtered out of the Hashtable by an upcall to a separate decision routine .