Hugh Jackman slammed for attending Met Gala with new girlfriend Sutton Foster - after split with ex-wife Deborra-Lee Furness: 'Thumbs down!'
Keir Starmer is facing a Muslim voter crisis as poll finds that more than half will tactically vote to boot Labour out this Thursday - with support collapsing from 80% to just 33%
Green Party prints 'sectarian' leaflets campaigning in six different languages ahead of local elections
The most outrageous flesh-baring outfits from Met Gala 2026 as turned-off critics blast 'cheap' displays
Nepo baby Blue Ivy, 14, makes her Met Gala debut as she steals spotlight from parents Beyonce and Jay-Z at 2026 bash
It Ends With Us... settled! Blake Lively and Justin Baldoni avoid explosive trial after feuding co-stars finally reach agreement in multimillion-dollar case
Classic ASCII game NetHack debuts version 5.0 just 11 years after last major release
CodeSOD: Not for Nullthing
Today's anonymous submitter sends us some code that just makes your mind go… blank when you look at it.
public static boolean isNull(String value) { return StringUtils.isBlank(value); }StringUtils.isBlank comes from the Apache Commons library. It's a helper function for Java which returns true if a string is, well, blank. "Blank" in this case is: empty, null, or only whitespace. So it's important to note that isBlank may return true on a null, but it isn't truly a null-check, so wrapping it in isNull is just confusing.
But imagine I've got another problem. Let's say I have a database that's been poorly normalized and maintained. And so I have a bunch of fields that maybe are null, but some also maybe contain the string "null". What am I going to do then? I need another function.
public static boolean isNullAndNull(String value) { return isNull(value) && "null".equalsIgnoreCase(value); }Ah yes, isNullAndNull, the clearest and easiest name I could imagine for this. It tells me exactly what the function is checking: is it null, and is it also null? We add a second check to our isNull call- we check if the input value matches the string "null". Except we're &&ing the conditions together. So this function will always return false. It can't both be blank and contain the string "null".
Which means Jennifer Null, who is a real person, can breathe easy. This version of a null check won't think she's nothing.
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.