From f6a473a81614c009e9929706745db3a6e214fad4 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 7 Oct 2016 01:47:10 +0800 Subject: [PATCH] Minor optimizations --- .../net/filebot/ui/rename/FilesListTransferablePolicy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java index 5633a2c0..0d94b423 100644 --- a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java +++ b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java @@ -51,14 +51,16 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy @Override protected void load(List files, TransferAction action) { + // use fast file to minimize system calls like length(), isDirectory(), isFile(), ... + files.replaceAll(FastFile::new); + // collect files recursively and eliminate duplicates Set sink = new LinkedHashSet(64, 4); // load files recursively by default load(files, action != TransferAction.LINK, sink); - // use fast file to minimize system calls like length(), isDirectory(), isFile(), ... and list files in human order - publish(sink.stream().map(FastFile::new).toArray(File[]::new)); + publish(sink.toArray(new File[0])); } private void load(List files, boolean recursive, Collection sink) {