@NotNull public static Future<Void> asyncDelete(@NotNull Collection<File> files) { List<File> tempFiles = new ArrayList<File>(); for (File file : files) { final File tempFile = renameToTempFileOrDelete(file); if (tempFile != null) { tempFiles.add(tempFile); } } if (!tempFiles.isEmpty()) { return startDeletionThread(tempFiles.toArray(new File[tempFiles.size()])); } return new FixedFuture<Void>(null); }
/** @return Map extension interface to array of implementation. */ public Map<Class<?>, Object[]> createExtensionMap() { Map<Class<?>, Object[]> extensions = new HashMap<>(extensionsCollector.size() * 2, 0.5f); for (Map.Entry<Class<?>, List<Object>> entry : extensionsCollector.entrySet()) { Class<?> extensionItf = entry.getKey(); List<Object> implementations = entry.getValue(); Object[] implArr = (Object[]) Array.newInstance(extensionItf, implementations.size()); implArr = implementations.toArray(implArr); extensions.put(extensionItf, implArr); } return extensions; }