* experiment with data structures for keeping/checking file trees in memory

This commit is contained in:
Reinhard Pointner 2015-04-10 15:50:35 +00:00
parent 0a7a3c36bf
commit 9ec4b6a97b
1 changed files with 10 additions and 5 deletions

View File

@ -77,9 +77,13 @@ public class FileSet extends AbstractSet<Path> {
@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<Path> {
return Stream.concat(descendants, children);
}
protected Path getPath(String path) {
return Paths.get(path);
}
@Override
public Spliterator<Path> spliterator() {
return stream().spliterator();
@ -117,4 +117,9 @@ public class FileSet extends AbstractSet<Path> {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
throw new UnsupportedOperationException();
}
}