* 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
|
@Override
|
||||||
public boolean contains(Object e) {
|
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
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return folders.values().stream().mapToInt(f -> f.size()).sum() + files.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);
|
return Stream.concat(descendants, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Path getPath(String path) {
|
|
||||||
return Paths.get(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Spliterator<Path> spliterator() {
|
public Spliterator<Path> spliterator() {
|
||||||
return stream().spliterator();
|
return stream().spliterator();
|
||||||
|
@ -117,4 +117,9 @@ public class FileSet extends AbstractSet<Path> {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue