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:org.jclouds.rds.options.ListInstancesOptions.java

@Override
public Multimap<String, String> buildFormParameters() {
    Multimap<String, String> params = super.buildFormParameters();
    if (marker != null)
        params.put("Marker", marker.toString());
    if (names.size() > 0) {
        int nameIndex = 1;
        for (String name : names) {
            params.put("InstanceNames.member." + nameIndex, name);
            nameIndex++;/*  w w  w.j  av  a2s  .co  m*/
        }
    }
    return params;
}

From source file:org.jclouds.sts.options.SessionCredentialsOptions.java

@Override
public Multimap<String, String> buildFormParameters() {
    Multimap<String, String> params = super.buildFormParameters();
    if (serialNumber != null)
        params.put("SerialNumber", serialNumber.toString());
    if (durationSeconds != null)
        params.put("DurationSeconds", durationSeconds.toString());
    if (tokenCode != null)
        params.put("TokenCode", tokenCode);
    return params;
}

From source file:org.jclouds.iam.options.ListUsersOptions.java

@Override
public Multimap<String, String> buildFormParameters() {
    Multimap<String, String> params = super.buildFormParameters();
    if (afterMarker != null)
        params.put("Marker", afterMarker.toString());
    if (maxItems != null)
        params.put("MaxItems", maxItems.toString());
    if (pathPrefix != null)
        params.put("PathPrefix", pathPrefix);
    return params;
}

From source file:org.thiesen.jiffs.jobs.clusterer.Clusterer.java

@Override
public void execute() {
    final Map<String, Long> foundClusters = findClusters();

    final Multimap<Long, String> clusters = HashMultimap.create();
    for (final Map.Entry<String, Long> entry : foundClusters.entrySet()) {
        clusters.put(entry.getValue(), entry.getKey());
    }//from  w ww.j ava2  s  .c o m

    storeClusters(clusters);

}

From source file:com.enonic.cms.store.dao.ResourceUsageDao.java

public Multimap<ResourceKey, ResourceReferencer> getUsedBy(ResourceKey resourceKey) {

    Multimap usedBy = HashMultimap.create();

    for (PortletEntity obj : contentObjectDao.findByStyle(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.CONTENT_OBJECT_STYLE));
    }/*from ww  w .  ja  v  a2s.c om*/
    for (PortletEntity obj : contentObjectDao.findByBorder(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.CONTENT_OBJECT_BORDER));
    }
    for (ContentTypeEntity obj : contentTypeDao.findByCSS(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.CONTENT_TYPE_CSS));
    }
    for (PageTemplateEntity obj : pageTemplateDao.findByStyle(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.PAGE_TEMPLATE_STYLE));
    }
    for (PageTemplateEntity obj : pageTemplateDao.findByCSS(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.PAGE_TEMPLATE_CSS));
    }
    for (SiteEntity obj : siteDao.findByDefaultCss(resourceKey)) {
        usedBy.put(resourceKey, new ResourceReferencer(obj, ResourceReferencerType.SITE_DEFAULT_CSS));
    }
    return usedBy;
}

From source file:net.diogobohm.timed.api.ui.domain.builder.OverviewBuilder.java

private Multimap<LocalDate, Task> createDayTaskMap(List<Task> tasks) {
    Multimap<LocalDate, Task> dayTaskIndex = HashMultimap.create();

    for (Task task : tasks) {
        LocalDate taskStart = LocalDate.fromDateFields(task.getStart());

        dayTaskIndex.put(taskStart, task);
    }/* ww w.  j a  v a2  s . c o m*/

    return dayTaskIndex;
}

From source file:com.qcadoo.mes.workPlans.pdf.document.operation.grouping.container.util.OrderIdOperationNumberOperationComponentIdMap.java

public void put(Long orderId, String operationNumber, Long operationComponentId) {
    Multimap<String, Long> innerMap = map.get(orderId);
    if (innerMap == null) {
        innerMap = HashMultimap.create();
        map.put(orderId, innerMap);//from   w  w w  . j  a v a2  s .c om
    }
    innerMap.put(operationNumber, operationComponentId);
}

From source file:org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions.java

@Override
public Multimap<String, String> buildQueryParameters() {
    Multimap<String, String> params = super.buildQueryParameters();
    if (name != null)
        params.put("name", name);
    if (pkg != null)
        params.put("package", pkg);
    params.putAll(Multimaps.forMap(Maps2.transformKeys(metadata, new Function<String, String>() {

        @Override/*from   ww  w.  j a  v a2 s.c om*/
        public String apply(String input) {
            return "metadata." + input;
        }

    })));
    return params;
}

From source file:baggage.AbstractBag.java

@Override
public Multimap<K, V> asMultiMap() {
    Multimap<K, V> map = makeEmptyMap();
    entries().forEach(e -> map.put(e.getKey(), e.getValue()));
    return map;/*from  ww  w  .  j  ava  2  s  .c  om*/
}

From source file:org.clueminer.eval.utils.Matching.java

/**
 * Allows searching in map by value, a cluster might be mapped to multiple
 * classes/* ww  w . jav  a2  s  .  c o  m*/
 *
 * @return
 */
public Multimap<String, String> inverse() {
    Multimap<String, String> multi = ArrayListMultimap.create();
    for (Map.Entry<String, String> e : matching.entrySet()) {
        multi.put(e.getValue(), e.getKey());
    }
    inverse = multi;
    return multi;
}