Add Strings.nonEmpty(String)
See original GitHub issuePlease add the following function to Strings
in order to allow testing for non-empty strings in Stream
s or Optional
s:
public static boolean nonEmpty(@Nullable String s) {
return s != null && !s.isEmpty();
}
This follows the pattern of Objects.nonNull
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
c# - Add to string if string non empty - Stack Overflow
Here is one option that I like. It's better if you already have an IEnumerable<string> with your data, but it's easy enough even...
Read more >Nonempty strings - Type Classes
If the input is equal to an empty string, for example, then we could return False, otherwise we would apply the isPalindrome function...
Read more >Is there a single word for a "non-empty" string?
I wouldn't call it "full". "Non-empty" or "non-null" works, but is there not a single word that unambiguously captures the meaning of "not...
Read more >Concatenating Null Strings in Java - Baeldung
Learn various approaches to avoid null String objects while concatenating Strings in Java.
Read more >Join non-Empty Strings with a Separator in JavaScript
The join method takes a separator as a parameter and joins the array elements into a string based on the provided separator. Here...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Duplicate of #3064?
I can understand wanting to do that, but I think it’s highly unlikely that the Guava team is going to introduce a new method whose semantics are the negation of an existing method to save people from having to do this:
I mean, method references are nifty but lambdas make this pretty painless IMO.