Example usage for com.google.common.collect ArrayListMultimap create

List of usage examples for com.google.common.collect ArrayListMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect ArrayListMultimap create.

Prototype

public static <K, V> ArrayListMultimap<K, V> create() 

Source Link

Document

Creates a new, empty ArrayListMultimap with the default initial capacities.

Usage

From source file:org.onosproject.dhcprelay.config.IgnoreDhcpConfig.java

public Multimap<DeviceId, VlanId> ignoredVlans() {
    Multimap<DeviceId, VlanId> ignored = ArrayListMultimap.create();

    array.forEach(node -> {//  w w  w.  ja  v a 2  s  .  co m
        DeviceId deviceId = DeviceId.deviceId(node.get(DEVICE_ID).asText());
        VlanId vlanId = VlanId.vlanId((short) node.get(VLAN_ID).asInt());
        ignored.put(deviceId, vlanId);
    });

    return ignored;
}

From source file:org.eclipse.che.workspace.infrastructure.openshift.server.OpenShiftServerResolver.java

public OpenShiftServerResolver(List<Service> services, List<Route> routes) {
    super(services, Collections.emptyList());

    this.routes = ArrayListMultimap.create();
    for (Route route : routes) {
        String machineName = Annotations.newDeserializer(route.getMetadata().getAnnotations()).machineName();
        this.routes.put(machineName, route);
    }//from  ww w  .  java 2 s .  c  o m
}

From source file:com.github.drbookings.ui.CleaningPlan.java

public CleaningPlan() {
    this.nameToCleaningEntry = ArrayListMultimap.create();
}

From source file:com.puppetlabs.xtext.dommodel.DomModelUtils.java

private static void appendEffectiveStyle(Appendable result, IDomNode node, String prefix) throws IOException {
    if (tracer == null) {
        result.append(" effective: [-off-]");
        return;// w w w  .j av  a  2 s.c  o m
    }
    StyleSet effective = tracer.getEffectiveStyle(node);
    if (effective == null) {
        result.append(" effective: [null]");
        return;
    }
    if (prefix.length() != 0) {
        result.append("\n");
        result.append(prefix);
    }

    result.append(" effective: [");
    EffectiveStyleAppender styleAppender = new EffectiveStyleAppender(result);
    ArrayListMultimap<String, IStyle<?>> ruleToStyle = ArrayListMultimap.create();
    if (effective instanceof StyleSetWithTracking) {
        StyleSetWithTracking trackingSet = (StyleSetWithTracking) effective;
        for (IStyle<?> style : effective.getStyles()) {
            String n = trackingSet.getStyleSource(style).getRuleName();
            if (n == null || n.length() < 1)
                throw new RuntimeException("Rule without name");
            ruleToStyle.put(n, style);
        }
    } else {
        for (IStyle<?> style : effective.getStyles()) {
            ruleToStyle.put("(unknown source)", style);
        }
    }
    boolean firstSource = true;
    for (String source : ruleToStyle.keySet()) {
        if (!firstSource)
            result.append(", ");
        firstSource = false;
        result.append("From: ");
        result.append(source);
        result.append(" {");
        boolean firstStyle = true;
        for (IStyle<?> style : ruleToStyle.get(source)) {
            if (!firstStyle)
                result.append(", ");
            firstStyle = false;
            style.visit(node, styleAppender);
        }
        result.append("}");
    }
    result.append("]");

}

From source file:io.scigraph.services.jersey.MultivaluedMapUtils.java

/***
 * Extracts both the path and query parameters from {@link UriInfo} into a {@link Multimap}
 * /*from   w  w w.  ja v  a 2 s. co  m*/
 * <p>Path parameters are additionally split on '+' to support multiple values 
 * 
 * @param uriInfo the uriinfo
 * @return the merged multimap
 */
public static Multimap<String, Object> merge(UriInfo uriInfo) {
    Multimap<String, Object> merged = ArrayListMultimap.create();
    merged.putAll(multivaluedMapToMultimap(uriInfo.getPathParameters(), Optional.of('+')));
    merged.putAll(multivaluedMapToMultimap(uriInfo.getQueryParameters()));
    return merged;
}

From source file:org.sonar.java.bytecode.visitor.ResourceMapping.java

public ResourceMapping() {
    directories = ArrayListMultimap.create();
    subDependencies = ArrayListMultimap.create();
    resourceByfileKey = new HashMap<>();
}

From source file:ezbake.frack.api.SimplePublisher.java

public Multimap<Class<? extends Serializable>, Envelope> getDataBetweenPipes() {
    Multimap<Class<? extends Serializable>, Envelope> result = dataBetweenPipes;
    dataBetweenPipes = ArrayListMultimap.create();
    return result;
}

From source file:org.franca.examples.validators.fidl.UniqueStateNameValidator.java

@Override
public void validateModel(FModel model, ValidationMessageAcceptor messageAcceptor) {

    for (FInterface _interface : model.getInterfaces()) {
        FContract contract = _interface.getContract();
        if (contract != null) {
            Multimap<String, FState> stateNameMap = ArrayListMultimap.create();

            for (FState state : contract.getStateGraph().getStates()) {
                stateNameMap.put(state.getName(), state);
            }//www .ja v  a2  s.c  o  m

            for (String name : stateNameMap.keySet()) {
                Collection<FState> states = stateNameMap.get(name);
                if (states.size() > 1) {
                    for (FState state : states) {
                        messageAcceptor.acceptError("The name of the state is not unique!", state,
                                FrancaPackage.Literals.FMODEL_ELEMENT__NAME,
                                ValidationMessageAcceptor.INSIGNIFICANT_INDEX, null);
                    }
                }
            }
        }
    }
}

From source file:com.zimbra.soap.account.type.Pref.java

public static Multimap<String, String> toMultimap(Iterable<Pref> prefs) {
    Multimap<String, String> map = ArrayListMultimap.create();
    for (Pref p : prefs) {
        map.put(p.getName(), p.getValue());
    }/*  www. ja  v  a  2 s  .  c  o m*/
    return map;
}

From source file:com.flipkart.ranger.finder.sharded.MapBasedServiceRegistry.java

@Override
public void nodes(List<ServiceNode<T>> nodes) {
    ListMultimap<T, ServiceNode<T>> serviceNodes = ArrayListMultimap.create();
    for (ServiceNode<T> serviceNode : nodes) {
        serviceNodes.put(serviceNode.getNodeData(), serviceNode);
    }/*from  ww  w .  j  a  v  a  2  s.  c om*/
    this.nodes.set(ImmutableListMultimap.copyOf(serviceNodes));
}