FileSystems { public static void delete(Collection<ResourceId> resourceIds, MoveOptions... moveOptions) throws IOException { if (resourceIds.isEmpty()) { return; } Collection<ResourceId> resourceIdsToDelete; if (Sets.newHashSet(moveOptions) .contains(MoveOptions.StandardMoveOptions.IGNORE_MISSING_FILES)) { resourceIdsToDelete = FluentIterable.from(matchResources(Lists.newArrayList(resourceIds))) .filter(matchResult -> !matchResult.status().equals(Status.NOT_FOUND)) .transformAndConcat( new Function<MatchResult, Iterable<Metadata>>() { @SuppressFBWarnings( value = "NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION", justification = "https: @Nonnull @Override public Iterable<Metadata> apply(@Nonnull MatchResult input) { try { return Lists.newArrayList(input.metadata()); } catch (IOException e) { throw new RuntimeException( String.format("Failed to get metadata from MatchResult: %s.", input), e); } } }) .transform( new Function<Metadata, ResourceId>() { @SuppressFBWarnings( value = "NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION", justification = "https: @Nonnull @Override public ResourceId apply(@Nonnull Metadata input) { return input.resourceId(); } }) .toList(); } else { resourceIdsToDelete = resourceIds; } if (resourceIdsToDelete.isEmpty()) { return; } getFileSystemInternal(resourceIdsToDelete.iterator().next().getScheme()) .delete(resourceIdsToDelete); }  static boolean hasGlobWildcard(String spec); static List<MatchResult> match(List<String> specs); static List<MatchResult> match(List<String> specs, EmptyMatchTreatment emptyMatchTreatment); static MatchResult match(String spec); static MatchResult match(String spec, EmptyMatchTreatment emptyMatchTreatment); static Metadata matchSingleFileSpec(String spec); static List<MatchResult> matchResources(List<ResourceId> resourceIds); static WritableByteChannel create(ResourceId resourceId, String mimeType); static WritableByteChannel create(ResourceId resourceId, CreateOptions createOptions); static ReadableByteChannel open(ResourceId resourceId); static void copy(
      List<ResourceId> srcResourceIds, List<ResourceId> destResourceIds, MoveOptions... moveOptions); static void rename(
      List<ResourceId> srcResourceIds, List<ResourceId> destResourceIds, MoveOptions... moveOptions); static void delete(Collection<ResourceId> resourceIds, MoveOptions... moveOptions); @Internal static void setDefaultPipelineOptions(PipelineOptions options); static ResourceId matchNewResource(String singleResourceSpec, boolean isDirectory); static final String DEFAULT_SCHEME; }
@Test public void testDeleteIgnoreMissingFiles() throws Exception { Path existingPath = temporaryFolder.newFile().toPath(); Path nonExistentPath = existingPath.resolveSibling("non-existent"); createFileWithContent(existingPath, "content1"); FileSystems.delete( toResourceIds(ImmutableList.of(existingPath, nonExistentPath), false )); }