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

Commit 04d021ce authored by Eugene Susla's avatar Eugene Susla
Browse files

Remove duplicate impl of CollectionUtils.emptyIfNull

(automated refactoring)

Test: presubmit
Change-Id: I65b88a8a11fac5bc948a7eb054eebc10b9f37f0d
parent ef76c77a
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -327,10 +327,6 @@ public class CollectionUtils {
        }
    }

    public static @NonNull <T> List<T> defeatNullable(@Nullable List<T> val) {
        return (val != null) ? val : Collections.emptyList();
    }

    /**
     * @return the first element if not empty/null, null otherwise
     */
+2 −2
Original line number Diff line number Diff line
@@ -1693,8 +1693,8 @@ class StorageManagerService extends IStorageManager.Stub
            int uid, String packageName, int[] ops) {
        long maxTime = 0;
        final List<AppOpsManager.PackageOps> pkgs = manager.getOpsForPackage(uid, packageName, ops);
        for (AppOpsManager.PackageOps pkg : CollectionUtils.defeatNullable(pkgs)) {
            for (AppOpsManager.OpEntry op : CollectionUtils.defeatNullable(pkg.getOps())) {
        for (AppOpsManager.PackageOps pkg : CollectionUtils.emptyIfNull(pkgs)) {
            for (AppOpsManager.OpEntry op : CollectionUtils.emptyIfNull(pkg.getOps())) {
                maxTime = Math.max(maxTime, op.getLastAccessTime());
            }
        }