Example usage for org.apache.commons.collections15 MultiMap map

List of usage examples for org.apache.commons.collections15 MultiMap map

Introduction

In this page you can find the example usage for org.apache.commons.collections15 MultiMap map.

Prototype

Map<K, Collection<V>> map();

Source Link

Document

Returns a java.util.Map<K,Collection<V>> for this MultiMap.

Usage

From source file:de.christianseipl.utilities.maputils.MapPrinting.java

public static <K, V> void printMultiMap(String _header, MultiMap<K, V> _map) {
    printMapCollection(_header, _map.map());
}

From source file:de.dhke.projects.cutil.stringer.CollectionStringer.java

@Override
public void append(StringBuilder sb, Object obj, final IToStringConverter backStringer) {
    if (obj instanceof Collection) {
        boolean first = true;
        sb.append("[");
        for (Object subObj : (Collection) obj) {
            if (first) {
                first = false;//from   ww w  .java2  s  .  c o m
            } else
                sb.append(", ");
            backStringer.append(sb, subObj, backStringer);
        }
        sb.append("]");
    } else if (obj instanceof Map) {
        final Map<?, ?> map = (Map<?, ?>) obj;
        boolean first = true;
        sb.append("{");
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (first) {
                first = false;
            } else
                sb.append(", ");
            backStringer.append(sb, entry.getKey(), backStringer);
            sb.append(": ");
            backStringer.append(sb, entry.getValue(), backStringer);
        }
        sb.append("}");
    } else if (obj instanceof MultiMap) {
        final MultiMap<?, ?> mMap = (MultiMap<?, ?>) obj;
        backStringer.append(sb, mMap.map(), backStringer);
    } else
        sb.append(obj);
}