Add filter(Class<U>) to filter by type.
Add filterMap for efficiency.