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:edu.umn.msi.tropix.client.search.impl.TropixSearchClientImpl.java

private List<GridData> transform(final Data[] inputData, final String serviceUrl) {
    final Data[] data = inputData == null ? new Data[0] : inputData;
    final List<GridData> results = new ArrayList<GridData>(data.length);
    Collections.transform(Arrays.asList(data), getConversionFunction(serviceUrl), results);
    final Multimap<String, GridData> gridDataByOwnerMap = HashMultimap.create();
    for (final GridData gridData : results) {
        gridDataByOwnerMap.put(gridData.getOwnerId(), gridData);
    }/*from  w  w w. j a v a2  s .  c  om*/
    for (final GridUser user : gridUserIterable) {
        if (gridDataByOwnerMap.containsKey(user.getGridId())) {
            for (final GridData gridData : gridDataByOwnerMap.get(user.getGridId())) {
                gridData.setUserName(user.toString());
            }
        }
    }
    return results;
}

From source file:de.minigames.mclib.nms.v185.items.CustomPickaxe.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//w w  w. j  av a 2s.c o  m
public Multimap i() {
    Multimap localMultimap = super.i();

    if (this.attackModifiersUsed) {
        localMultimap.put(GenericAttributes.ATTACK_DAMAGE.getName(),
                new AttributeModifier(f, "Tool modifier", this.attackDmg, 0)); //$NON-NLS-1$
    }

    return localMultimap;
}

From source file:de.minigames.mclib.nms.v183.items.CustomShovel.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override/*from  w  w  w . j  a  v a  2  s .  c  o  m*/
public Multimap i() {
    Multimap localMultimap = super.i();

    if (this.attackModifiersUsed) {
        localMultimap.put(GenericAttributes.e.getName(),
                new AttributeModifier(f, "Tool modifier", this.attackDmg, 0)); //$NON-NLS-1$
    }

    return localMultimap;
}

From source file:cherry.foundation.testtool.stub.StubConfigurer.java

private Multimap<String, Method> createMethodMap(Method[] methods) {
    Multimap<String, Method> map = MultimapBuilder.hashKeys().arrayListValues().build();
    for (Method m : methods) {
        map.put(getMethodDescription(m, false, false, true, false, false), m);
        map.put(getMethodDescription(m, false, false, true, true, false), m);
        map.put(getMethodDescription(m, false, false, true, true, true), m);
    }/*from  w ww. j ava 2 s  .  co  m*/
    return map;
}

From source file:nl.tue.gale.ae.processor.XMLProcessor.java

public Map<List<String>, Module> getModuleTable() {
    Map<List<String>, Module> result = new HashMap<List<String>, Module>();
    Multimap<Module, String> buildMap = HashMultimap.create();
    for (Map.Entry<String, Module> entry : moduleTable.entrySet())
        buildMap.put(entry.getValue(), entry.getKey());
    for (Map.Entry<Module, Collection<String>> entry : buildMap.asMap().entrySet())
        result.put(new ArrayList<String>(entry.getValue()), entry.getKey());
    return result;
}

From source file:org.robotframework.ide.eclipse.main.plugin.navigator.handlers.ChangeExclusionHandler.java

private Multimap<IProject, IPath> groupByProject(final List<IResource> resourcesToChange) {
    final Multimap<IProject, IPath> groupedPaths = LinkedListMultimap.create();
    for (final IResource resource : resourcesToChange) {
        groupedPaths.put(resource.getProject(), resource.getProjectRelativePath());
    }/*from w w  w .  j  a va2 s. c  o  m*/
    return groupedPaths;
}

From source file:org.jclouds.elb.options.ListPoliciesOptions.java

@Override
public Multimap<String, String> buildFormParameters() {
    Multimap<String, String> params = super.buildFormParameters();
    if (loadBalancerName != null)
        params.put("LoadBalancerName", loadBalancerName);
    if (names.size() > 0) {
        int nameIndex = 1;
        for (String name : names) {
            params.put("PolicyNames.member." + nameIndex, name);
            nameIndex++;//from   w ww .j a  v  a  2 s  . c  o m
        }
    }
    return params;
}

From source file:com.haulmont.timesheets.global.WeeklyReportConverter.java

public List<WeeklyReportEntry> convertFromTimeEntries(List<TimeEntry> timeEntries) {

    if (timeEntries.isEmpty()) {
        return Collections.emptyList();
    }//from w ww. j av  a 2 s.  c  o  m

    final Multimap<TimeEntryGroupKey, TimeEntry> groupedTimeEntries = ArrayListMultimap.create();

    for (TimeEntry timeEntry : timeEntries) {
        groupedTimeEntries.put(new TimeEntryGroupKey(timeEntry), timeEntry);
    }

    if (groupedTimeEntries.isEmpty()) {
        return Collections.emptyList();
    }

    List<WeeklyReportEntry> reportEntries = new ArrayList<>();
    for (Map.Entry<TimeEntryGroupKey, Collection<TimeEntry>> entry : groupedTimeEntries.asMap().entrySet()) {
        WeeklyReportEntry reportEntry = new WeeklyReportEntry();
        TimeEntryGroupKey entryKey = entry.getKey();
        reportEntry.setProject(entryKey.project);
        reportEntry.setTask(entryKey.task);
        reportEntry.setActivityType(entryKey.activityType);
        for (TimeEntry timeEntry : entry.getValue()) {
            reportEntry.addTimeEntry(timeEntry);
        }
        reportEntries.add(reportEntry);
    }

    return reportEntries;
}

From source file:eu.lp0.cursus.xml.scores.results.ScoresXMLSeriesResults.java

public ScoresXMLSeriesResults(Scores scores) {
    super(scores);

    series = AbstractXMLEntity.generateId(scores.getSeries());

    discards = scores.getDiscardCount();

    Multimap<Event, Race> events_ = LinkedHashMultimap.create(scores.getRaces().size(),
            scores.getRaces().size());//from  w ww  .j a  va 2s.c o m
    for (Race race : scores.getRaces()) {
        events_.put(race.getEvent(), race);
    }

    eventResults = new ArrayList<ScoresXMLSeriesEventResults>(events_.keySet().size());
    for (Entry<Event, Collection<Race>> event : events_.asMap().entrySet()) {
        eventResults.add(new ScoresXMLSeriesEventResults(scores, event.getKey(), event.getValue()));
    }
}

From source file:com.google.jstestdriver.output.XmlPrinterImpl.java

public void writeXmlReportFiles() {
    Map<BrowserInfo, String> browserNames = createUniqueBrowserNames(resultHolder.getResults().keySet());
    for (BrowserInfo browser : resultHolder.getResults().keySet()) {
        Multimap<String, TestResult> testCaseRollup = newMultiMap();
        for (TestResult testResult : resultHolder.getResults().get(browser)) {
            testCaseRollup.put(testResult.getTestCaseName(), testResult);
        }//w w  w.  ja v  a  2  s.  co  m
        for (String testCaseName : testCaseRollup.keySet()) {
            String suiteName = formatSuiteName(browserNames.get(browser), testCaseName);
            File xmlOutputFile = new File(xmlOutputDir, formatFileName(suiteName));
            try {
                xmlOutputFile.createNewFile();
                TestXmlSerializer serializer = new TestXmlSerializer(new FileWriter(xmlOutputFile));

                serializer.writeTestCase(suiteName, testCaseRollup.get(testCaseName));
            } catch (IOException e) {
                logger.error("Could not create file: {}", xmlOutputFile.getAbsolutePath(), e);
            }
        }
    }
}