use subList().clear instead of a loop of remove(0)

This commit is contained in:
XenoAmess 2020-06-05 04:20:29 +08:00 committed by Gilles Sadowski
parent ba8a26705e
commit e34ea727ca
1 changed files with 2 additions and 2 deletions

View File

@ -197,8 +197,8 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
//Discard elements from the front of the list if the windowSize is less than //Discard elements from the front of the list if the windowSize is less than
// the size of the list. // the size of the list.
int extra = list.size() - windowSize; int extra = list.size() - windowSize;
for (int i = 0; i < extra; i++) { if (extra > 0) {
list.remove(0); list.subList(0, extra).clear();
} }
} }