public static < E > Set < E > retainAbove ( Counter < E > counter , double countThreshold ) { Set < E > removed = new HashSet < E > ( ) ; for ( E key : counter . keySet ( ) ) { if ( counter . getCount ( key ) < countThreshold ) { removed . add ( key ) ; } } for ( E key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with counts below the given threshold returning the set of removed entries .