Get last length elements, not first

This commit is contained in:
Fabian Wiesel
2024-02-17 00:55:27 +01:00
parent a9f5b233e6
commit 7fd7451700

View File

@@ -61,10 +61,11 @@ public class VolumeHistory {
public VolumeHistory getSnapshot(int length) {
length = Math.min(length, size());
VolumeHistory copy = new VolumeHistory(length);
final VolumeHistory copy = new VolumeHistory(length);
copy.mMaxVolume = this.mMaxVolume;
copy.mVolumeNorm = this.mVolumeNorm;
for (int i = 0; i < length; ++i) {
final int leftMost = size() - length;
for (int i = leftMost; i < size(); ++i) {
copy.mHistory.addLast(mHistory.get(i));
}