Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(MapUtils): Add empty string judgment #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kingsmao
Copy link

Add empty string judgment

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current behaviour, described in the javadocs, only guarantees that the method is null-safe. It doesn't say anything about empty strings. Eventually someone could request that blank (i.e. " ") strings are also ignored. But IMO, these cases are better handled in the user application, leaving this method to return the .toString() of an object in the map/key.

If the user doesn't want "" or " " strings, s/he can filter those values later. Also, I'm not sure if the Object answer is a String, in which case it wouldn't make sense to have the answer != "" check too.

@garydgregory
Copy link
Member

-1 I agree with @kinow. This would also create a bad precedent where empty strings are treated differently in a single method and also likely to break existing applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants