You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/11/17 00:09:01 UTC
svn commit: r1714708 -
/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java
Author: tn
Date: Mon Nov 16 23:09:01 2015
New Revision: 1714708
URL: http://svn.apache.org/viewvc?rev=1714708&view=rev
Log:
Add toString method in AbstractMultiValuedMap#KeysMultiSet.
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java?rev=1714708&r1=1714707&r2=1714708&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java Mon Nov 16 23:09:01 2015
@@ -716,6 +716,28 @@ public abstract class AbstractMultiValue
};
}
+ @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();
+ }
+
}
/**