Simplifying removeAll method.
JobStore.removeAll() iterates through an ArraySet and removes jobs that satisfy a predicate. The repeated removals will cause ArraySet to do many System.arraycopy calls and could cause the ArraySet to resize its internal array several times during the iteration. ArraySet has a removeIf(Predicate) method which does this exact task without repeatedly resizing the array or doing many System.arraycopy calls. Switching to ArraySet.removeIf will reduce the amount of code and improve performance in some cases. Bug: 141645789 Test: atest com.android.server.job.JobStoreTest Change-Id: Icbdcda219c115288d13a3508e8b4762783301eb0
Loading
Please register or sign in to comment