ArrayMap implements Map<K, V> { @Override public String toString() { if (isEmpty()) { return "{}"; } StringBuilder buffer = new StringBuilder(mSize * 28); buffer.append('{'); for (int i = 0; i < mSize; i++) { if (i > 0) { buffer.append(", "); } Object key = keyAt(i); if (key != this) { buffer.append(key); } else { buffer.append("(this Map)"); } buffer.append('='); Object value = valueAt(i); if (value != this) { buffer.append(value); } else { buffer.append("(this Map)"); } } buffer.append('}'); return buffer.toString(); } ArrayMap();  ArrayMap(int capacity);  ArrayMap(ArrayMap<K, V> map); void clear(); void ensureCapacity(int minimumCapacity); boolean containsKey(Object key); int indexOfKey(Object key); boolean containsValue(Object value); @SuppressWarnings("unchecked") V get(Object key); @SuppressWarnings("unchecked") K keyAt(int index); @SuppressWarnings("unchecked") V valueAt(int index); boolean isEmpty(); @SuppressWarnings("unchecked") V put(K key, V value); @Override Iterable<V> values(); @SuppressWarnings("unchecked") void putAll(Map<? extends K, ? extends V> map); V remove(Object key); @SuppressWarnings("unchecked") V removeAt(int index); int size(); @Override boolean equals(Object object); @Override int hashCode(); @SuppressWarnings({"unchecked", "CloneDoesntCallSuperClone"}) @Override ArrayMap<K, V> clone(); @Override String toString();  }
@Test public void shouldPrintDataIfEmpty() { mArrayMap = new ArrayMap<>(1); assertEquals("{}", mArrayMap.toString()); }