method should throw exception if input is empty and ignore nulls in non
empty input