Example usage for org.apache.commons.collections4 SetValuedMap put

List of usage examples for org.apache.commons.collections4 SetValuedMap put

Introduction

In this page you can find the example usage for org.apache.commons.collections4 SetValuedMap put.

Prototype

boolean put(K key, V value);

Source Link

Document

Adds a key-value mapping to this multi-valued map.

Usage

From source file:com.github.sevntu.checkstyle.ordering.MethodOrder.java

private static MultiValuedMap<MethodInvocation, MethodInvocation> getMethodInvocationsNesting(
        Map<ResolvedCall, MethodInvocation> callToInvocation) {

    final SetValuedMap<MethodInvocation, MethodInvocation> nestedInside = new HashSetValuedHashMap<>();
    callToInvocation.entrySet().stream().forEach(entry -> {
        final ResolvedCall resolvedCall = entry.getKey();
        final MethodInvocation methodInvocation = entry.getValue();
        callToInvocation.keySet().stream().filter(rc -> !rc.equals(resolvedCall))
                .filter(resolvedCall::isNestedInside)
                .forEach(rc -> nestedInside.put(methodInvocation, callToInvocation.get(rc)));
    });/*www  .j  a  v a 2 s  . c o  m*/
    return nestedInside;
}

From source file:com.github.alexfalappa.nbspringboot.navigator.MappedElement.java

private final String computeHandlerSignature(Element element) {
    StringBuilder sb = new StringBuilder(element.getSimpleName());
    if (element instanceof ExecutableElement) {
        // store arguments with same unqualified type name
        ExecutableElement eel = (ExecutableElement) element;
        SetValuedMap<String, String> mm = new HashSetValuedHashMap<>();
        for (VariableElement var : eel.getParameters()) {
            String fullType = var.asType().toString();
            mm.put(Utils.shortenJavaType(fullType), fullType);
        }//from   w w w  .j av  a2s.c  om
        // build up argument list
        sb.append('(');
        for (int i = 0; i < eel.getParameters().size(); i++) {
            VariableElement var = eel.getParameters().get(i);
            String fullType = var.asType().toString();
            final String shortType = Utils.shortenJavaType(fullType);
            if (mm.get(shortType).size() > 1) {
                sb.append(fullType);
            } else {
                sb.append(shortType);
            }
            if (i < eel.getParameters().size() - 1) {
                sb.append(", ");
            }
        }
        sb.append(") : ");
        sb.append(Utils.shortenJavaType(eel.getReturnType().toString()));
    }
    return sb.toString();
}