Add toString method in AbstractMultiValuedMap#KeysMultiSet.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1714708 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ed80d9d68
commit
ccda2db161
|
@ -716,6 +716,28 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (size() == 0) {
|
||||
return "[]";
|
||||
}
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append('[');
|
||||
final Iterator<K> it = KeysMultiSet.this.uniqueSet().iterator();
|
||||
while (it.hasNext()) {
|
||||
final Object current = it.next();
|
||||
final int count = getCount(current);
|
||||
buf.append(current);
|
||||
buf.append(':');
|
||||
buf.append(count);
|
||||
if (it.hasNext()) {
|
||||
buf.append(", ");
|
||||
}
|
||||
}
|
||||
buf.append(']');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue