Any reason why you didn't write

    if (!consolidateShuffleFiles) {
      unusedFileIds.add(fileId)
    }