code: public static boolean deleteIfExists(final File file) {
          if ((file == null) || !file.exists()) {
              return false;
          }
  
          return file.delete();
      }
docs: Delete the specified file (or directory).
  
  @param file
  @return true if the file is deleted successfully, otherwise false if the file is null or doesn't exist, or can't be deleted.