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

Commit db7e2c72 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Replace LinkedList by a more performant collection

This is a semi-automatic change.
See go/bugpattern/JdkObsolete#linkedlist for the rationale

Test: make
Bug: 221046110
Change-Id: Ic36738ad7159f759da330ae90441644bbba7ee2c
parent dbb79760
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()) {