Andrew Mountbatten-Windsor is giving up the lease on a property... and it's not Royal Lodge
Crash on A12 southbound - traffic building to Colchester Football Stadium
Police 'concerned' about 14-year old girl missing from her home in Essex
QUENTIN LETTS: Reeves ignored the Tories' impertinence... nothing was going to get in the way of that haircut
Why Britain's Got Talent's standout performance poet will NEVER win the show - and the genius reason ITV have drummed up hype around him regardless
People should get financial education at work: The entrepreneur who wants her '2Mins' app to help
Should we open a joint bank account -and how do we pick the best one?
Microplastics and Nanoplastics In Urban Air Originate Mainly From Tire Abrasion, Research Reveals
Read more of this story at Slashdot.
NASA Repairs Artemis 2 Rocket, Continues Eyeing April Moon Launch
Read more of this story at Slashdot.
Beloved village green given 'protected' status to stop it being built on
CodeSOD: Repeating Your Existence
Today's snippet from Rich D is short and sweet, and admittedly, not the most TFs of WTFs out there. But it made me chuckle, and sometimes that's all we need. This Java snippet shows us how to delete a file:
if (Files.exists(filePath)) { Files.deleteIfExists(filePath); }If the file exists, then if it exists, delete it.
This commit was clearly submitted by the Department of Redundancy Department. One might be tempted to hypothesize that there's some race condition or something that they're trying to route around, but if they are, this isn't the way to do it, per the docs: "Consequently this method may not be atomic with respect to other file system operations." But also, I fail to see how this would do that anyway.
The only thing we can say for certain about using deleteIfExists instead of delete is that deleteIfExists will never throw a NoSuchFileException.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!