mirror of
https://github.com/topjohnwu/libsu.git
synced 2024-11-30 07:20:27 +00:00
Create List without creating intermediate Runnable array
This commit is contained in:
parent
51c0c0edc5
commit
4019178cbe
@ -19,7 +19,7 @@ package com.topjohnwu.superuser.internal;
|
||||
import androidx.annotation.RestrictTo;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.AbstractExecutorService;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -77,7 +77,7 @@ public class SerialExecutorService extends AbstractExecutorService implements Ca
|
||||
if (scheduleTask != null)
|
||||
scheduleTask.cancel(true);
|
||||
try {
|
||||
return Arrays.asList(mTasks.toArray(new Runnable[]{}));
|
||||
return new ArrayList<>(mTasks);
|
||||
} finally {
|
||||
mTasks.clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user