diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-06-20 18:59:11 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-06-21 15:03:41 -0700 |
commit | a17c0f5e164729210210ad3f75aea72ed34ca330 (patch) | |
tree | 359b8a690de135352da3a508c69948c564d564fa /core/java/android/util/ArraySet.java | |
parent | fb5a41a371e540f402e3dd987b0fbf92d1267902 (diff) | |
download | frameworks_base-a17c0f5e164729210210ad3f75aea72ed34ca330.zip frameworks_base-a17c0f5e164729210210ad3f75aea72ed34ca330.tar.gz frameworks_base-a17c0f5e164729210210ad3f75aea72ed34ca330.tar.bz2 |
More procstats work: separate global proc account, more dumping.
We now keep track of the time actually process run independently
of the time packages run in process, so we can give an accurate
summary of how long each physical process runs.
New command line options can be supplied to restrict printing to
a specific package, dump in a new csv format, control what is
printed in the csv format, and print a checkin report.
Add toString methods to ArrayMap and ArraySet.
Change-Id: I47b8f68472592ecc0088c5286d3564aa615f4e0a
Diffstat (limited to 'core/java/android/util/ArraySet.java')
-rw-r--r-- | core/java/android/util/ArraySet.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/java/android/util/ArraySet.java b/core/java/android/util/ArraySet.java index a84c47c..2d3380e 100644 --- a/core/java/android/util/ArraySet.java +++ b/core/java/android/util/ArraySet.java @@ -493,6 +493,36 @@ public final class ArraySet<E> implements Collection<E>, Set<E> { return result; } + /** + * {@inheritDoc} + * + * <p>This implementation composes a string by iterating over its values. If + * this set contains itself as a value, the string "(this Set)" + * will appear in its place. + */ + @Override + public String toString() { + if (isEmpty()) { + return "{}"; + } + + StringBuilder buffer = new StringBuilder(mSize * 14); + buffer.append('{'); + for (int i=0; i<mSize; i++) { + if (i > 0) { + buffer.append(", "); + } + Object value = valueAt(i); + if (value != this) { + buffer.append(value); + } else { + buffer.append("(this Set)"); + } + } + buffer.append('}'); + return buffer.toString(); + } + // ------------------------------------------------------------------------ // Interop with traditional Java containers. Not as efficient as using // specialized collection APIs. |