public static < R > Set < R > filterAndListKeys ( Iterator < R > keys , KeyFilter < R > filter ) { Set < R > ret = new HashSet < R > ( ) ; while ( keys . hasNext ( ) ) { R key = keys . next ( ) ; R filtered = filter . filter ( key ) ; if ( filtered != null ) { ret . add ( filtered ) ; } } return ret ; }
Filters keys based on the KeyFilter passed as the argument .