* experiment with data structures for keeping/checking file trees in memory
This commit is contained in:
parent
0a7a3c36bf
commit
9ec4b6a97b
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue