From 9ec4b6a97bee207544313fcba8907898d3e78c39 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 10 Apr 2015 15:50:35 +0000 Subject: [PATCH] * experiment with data structures for keeping/checking file trees in memory --- source/net/filebot/util/FileSet.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/util/FileSet.java b/source/net/filebot/util/FileSet.java index 0cf3e58c..8319f74f 100644 --- a/source/net/filebot/util/FileSet.java +++ b/source/net/filebot/util/FileSet.java @@ -77,9 +77,13 @@ public class FileSet extends AbstractSet { @Override public boolean contains(Object e) { - return e == null ? false : contains(getPath(e.toString())); + return contains(e.toString()); }; + protected Path getPath(String path) { + return Paths.get(path); + } + @Override public int size() { return folders.values().stream().mapToInt(f -> f.size()).sum() + files.size(); @@ -98,10 +102,6 @@ public class FileSet extends AbstractSet { return Stream.concat(descendants, children); } - protected Path getPath(String path) { - return Paths.get(path); - } - @Override public Spliterator spliterator() { return stream().spliterator(); @@ -117,4 +117,9 @@ public class FileSet extends AbstractSet { throw new UnsupportedOperationException(); } + @Override + public void clear() { + throw new UnsupportedOperationException(); + } + }