We should try getTypes().contains(type) first and only apply this additional logic if the fast check fails.