Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 670d75fd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Replace LinkedList by a more performant collection"

parents 206bd671 db7e2c72
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -62,7 +62,9 @@ import java.nio.file.FileVisitor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -232,9 +234,9 @@ public abstract class FileSystemProvider extends DocumentsProvider {
            throw new FileNotFoundException(doc + " is not found under " + parent);
        }

        LinkedList<String> path = new LinkedList<>();
        List<String> path = new ArrayList<>();
        while (doc != null && FileUtils.contains(parent, doc)) {
            path.addFirst(getDocIdForFile(doc));
            path.add(0, getDocIdForFile(doc));

            doc = doc.getParentFile();
        }
@@ -448,10 +450,10 @@ public abstract class FileSystemProvider extends DocumentsProvider {
            File folder, String[] projection, Set<String> exclusion, Bundle queryArgs)
            throws FileNotFoundException {
        final MatrixCursor result = new MatrixCursor(resolveProjection(projection));
        final LinkedList<File> pending = new LinkedList<>();
        final List<File> pending = new ArrayList<>();
        pending.add(folder);
        while (!pending.isEmpty() && result.getCount() < 24) {
            final File file = pending.removeFirst();
            final File file = pending.remove(0);
            if (shouldHide(file)) continue;

            if (file.isDirectory()) {