Timeline for What is the best way to know if all the variables in a Class are null?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 4 at 16:03 | comment | added | Didier L | @RHronza the Spring documentation tells you that it is for internal use, and recommends to use something else (that does the same thing) | |
Jul 4 at 14:20 | comment | added | RHronza | @DidierL: I stated that it is only used with Spring, the advantage is not only null safe, but also empty safe | |
Jul 3 at 14:49 | comment | added | Didier L |
@RHronza That one exists for internal use within the Spring framework, I would recommend using the StringUtils of Apache Commons Lang instead, as recommended by Spring’s StringUtils javadoc itself!
|
|
Jul 3 at 13:44 | comment | added | RHronza | If you're using Spring, it has a nice hasText method. If you need to check if at least one field is not null and has text (not empty), it could look like this(intended as a class method):: Stream.of(field1, field2,...fieldN).anyMatch(StringUtils::hasText); | |
Feb 7, 2023 at 13:01 | history | rollback | Didier L |
Rollback to Revision 2
|
|
Feb 7, 2023 at 11:17 | history | edited | Shashank Vivek | CC BY-SA 4.0 |
added 84 characters in body
|
Mar 3, 2018 at 13:39 | comment | added | Didier L |
@Rinsen you can use filter() but that's a different question and it's likely to have already been asked on SO.
|
|
Mar 3, 2018 at 13:31 | comment | added | Rinsen S | Is there any way to get the field values eg: Stream.of(id, name), remove null fields and return List of values of not null fields | |
May 23, 2017 at 10:31 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Oct 25, 2016 at 11:36 | history | answered | Didier L | CC BY-SA 3.0 |