Example usage for com.google.common.collect Multimap put

List of usage examples for com.google.common.collect Multimap put

Introduction

In this page you can find the example usage for com.google.common.collect Multimap put.

Prototype

boolean put(@Nullable K key, @Nullable V value);

Source Link

Document

Stores a key-value pair in this multimap.

Usage

From source file:com.isotrol.impe3.web20.client.content.counter.ContentCounterComponent.java

/**
 * Generates and IMG URI for the action.
 * @param context Render context.//from   w  w w. j  a v  a2s.co  m
 * @return URI to use.
 */
String getURI(final RenderContext context) {
    if (contentKey == null) {
        return null;
    }
    final String idr = contentKey.getContentType().getStringId() + ':' + contentKey.getContentId();
    final String ct = config.counterType();
    Multimap<String, Object> parameters = ArrayListMultimap.create();
    parameters.put("idr", idr);
    parameters.put("ct", ct);
    return context.getAbsoluteActionURI("countAction", parameters).toASCIIString();
}

From source file:org.openqa.selenium.docker.ContainerInfo.java

public ContainerInfo map(Port containerPort, Port hostPort) {
    Objects.requireNonNull(containerPort);
    Objects.requireNonNull(hostPort);

    if (!hostPort.getProtocol().equals(containerPort.getProtocol())) {
        throw new DockerException(
                String.format("Port protocols must match: %s -> %s", hostPort, containerPort));
    }/*from  ww w . j  a  va 2  s.co  m*/

    Multimap<String, Map<String, Object>> updatedBindings = HashMultimap.create(portBindings);
    updatedBindings.put(containerPort.getPort() + "/" + containerPort.getProtocol(),
            ImmutableMap.of("HostPort", String.valueOf(hostPort.getPort()), "HostIp", ""));

    return new ContainerInfo(image, updatedBindings);
}

From source file:org.cejug.hurraa.validation.CejugErrorMap.java

public CejugErrorMap(List<Message> messages) {
    Multimap<String, String> out = ArrayListMultimap.create();
    for (Message message : messages) {
        out.put(message.getCategory(), message.getMessage());
    }/*from   w w  w .j a v  a 2  s .  c o m*/
    this.delegate = out.asMap();
    this.messages = messages;

}

From source file:com.griddynamics.jagger.engine.e1.collector.MasterWorkloadCollector.java

private void putValues(String sessionId, String taskId, Collection<NodeId> capableNodes,
        WorkloadTask workload) {/*  ww  w.  j  av  a 2 s  .  c  om*/
    Namespace sessionNamespace = Namespace.of(SESSION, sessionId);
    keyValueStorage.put(sessionNamespace, SCENARIOS, taskId);

    Namespace scenarioNamespace = Namespace.of(sessionId, taskId);
    Multimap<String, Object> objectsMap = HashMultimap.create();
    objectsMap.put(START_TIME, System.currentTimeMillis() + workload.getStartDelay());

    objectsMap.put(CLOCK, workload.getClock().toString());
    objectsMap.put(CLOCK_VALUE, workload.getClock().getValue());
    objectsMap.put(TERMINATION, workload.getTerminateStrategyConfiguration().toString());

    objectsMap.put(KERNEL_COUNT, capableNodes.size());
    for (NodeId nodeId : capableNodes) {
        String nodeStr = nodeId.toString();
        log.debug("kernels: {}", nodeStr);
        objectsMap.put(KERNELS, nodeStr);
    }
    keyValueStorage.putAll(scenarioNamespace, objectsMap);
}

From source file:vazkii.b_baubles.common.item.equipment.bauble.ItemKnockbackBelt.java

@Override
void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
    attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
            new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 1, 0));
}

From source file:com.cinchapi.concourse.example.bank.ConcourseCustomer.java

/**
 * This constructor creates a new record in Concourse and inserts the data
 * expressed in the parameters.//  w ww  . j  av  a 2s. c  o m
 * 
 * @param firstName the customer's first name
 * @param lastName the customer's last name
 */
public ConcourseCustomer(String firstName, String lastName) {
    Concourse concourse = Constants.CONCOURSE_CONNECTIONS.request();
    try {
        Multimap<String, Object> data = HashMultimap.create();
        data.put(CLASS_KEY_NAME, getClass().getName());
        data.put("first_name", firstName);
        data.put("last_name", lastName);
        this.id = concourse.insert(data);
    } finally {
        Constants.CONCOURSE_CONNECTIONS.release(concourse);
    }
}

From source file:vazkii.botania.common.item.relic.ItemOdinRing.java

void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
    attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(),
            new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 20, 0));
}

From source file:org.lightjason.agentspeak.action.builtin.collection.multimap.CPutSingle.java

@Override
protected final void apply(@Nonnull final Multimap<Object, Object> p_instance, @Nonnull final Object p_key,
        @Nullable final Object p_value) {
    p_instance.put(p_key, p_value);
}

From source file:com.eincs.decanter.container.simple.route.SimpleRouteService.java

/**
 * //w  w w .  jav a  2  s . c o  m
 * @param serviceObj
 * @return
 * @throws RouteReflectException
 */
public static Multimap<SimpleRouteServiceId, SimpleRouteService> createServices(Object serviceObj)
        throws RouteReflectException {
    Multimap<SimpleRouteServiceId, SimpleRouteService> result = ArrayListMultimap.create();
    FastClass clazz = FastClass.create(serviceObj.getClass());

    // extract serviceId and method from serviceObj
    for (MethodRouteInfo methodInfo : MethodExtractor.extract(serviceObj)) {
        FastMethod method = clazz.getMethod(methodInfo.getMethod());
        Class<?>[] parameters = method.getParameterTypes();

        // check paramters of the method
        if (!ArrayUtils.isEquals(METHOD_PARAMTER, parameters)) {
            throw new RouteReflectException(String.format("method(%s) is not applicable for SimpleRouteService",
                    Arrays.asList(parameters)));
        }

        // create service object and add to the result multimap
        SimpleRouteService service = new SimpleRouteService(serviceObj, method);
        List<SimpleRouteServiceId> serviceIds = SimpleRouteServiceId.create(methodInfo);
        for (SimpleRouteServiceId serviceId : serviceIds) {
            result.put(serviceId, service);
        }
    }
    return result;
}

From source file:org.lightjason.agentspeak.action.builtin.collection.multimap.CPutMultiple.java

@Override
protected void apply(@Nonnull final Multimap<Object, Object> p_instance, @Nonnull final Object p_key,
        @Nullable final Object p_value) {
    p_instance.put(p_key, p_value);
}