Labour MPs 'to copy coup that ousted Tony Blair' as polls show scale of Starmer's looming elections bloodbath
The torment of Egypt's emaciated horses - and the shame of the Western tourists who enable a cycle of abuse that ends only when the animals drop dead: ELEANOR HARMSWORTH
Somerset couple reveal how they bought a caravan and now holiday 240 nights a year for just £3.60 per person - and get access to a private beach
Blake Lively shocks at Met Gala in first interview since settling Justin Baldoni war... but husband Ryan Reynolds is nowhere to be seen
Mrs Hinch fans swear by 65p method to banish stubborn washing machine mould
Astronomers May Have Detected an Atmosphere Around a Tiny, Icy World Past Pluto
Read more of this story at Slashdot.
Kim Kardashian's inspiration for sculpted Met Gala look with controversial backstory is revealed
K-pop stars take over the 2026 Met Gala: Blackpink and Aespa dominate the red carpet in dazzling crystal couture
Charli XCX leaves very little to the imagination as she poses in her underwear while preparing for the annual Met Gala
Obama confesses Trump has caused 'tension' in his marriage after Michelle issues dramatic plea
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.