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

Commit 5ea42287 authored by Kweku Adams's avatar Kweku Adams
Browse files

Overriding toString method.

LongArrayQueue wasn't overriding the toString method, so it couldn't be used
in dumps.

Bug: 135764360
Test: atest CountQuotaTrackerTest
Change-Id: I02b1d22f8cf0fca96d0fdaff3becaa07e46ddb06
parent 4324208b
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -162,4 +162,24 @@ public class LongArrayQueue {
        final int index = (mTail == 0) ? mValues.length - 1 : mTail - 1;
        return mValues[index];
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        if (mSize <= 0) {
            return "{}";
        }

        final StringBuilder buffer = new StringBuilder(mSize * 64);
        buffer.append('{');
        buffer.append(get(0));
        for (int i = 1; i < mSize; i++) {
            buffer.append(", ");
            buffer.append(get(i));
        }
        buffer.append('}');
        return buffer.toString();
    }
}