Repeating Your Existence
by in CodeSOD on 2026-03-04Today'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);
}