List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:eu.interedition.text.xml.module.TEIAwareAnnotationXMLParserModule.java
@Override public void start(XMLParserState state) { super.start(state); this.spanning = ArrayListMultimap.create(); this.milestones = Maps.newHashMap(); }
From source file:org.sonar.db.version.v451.AddMissingCustomRuleParametersMigrationStep.java
@Override public void execute() { ProgressLogger progress = ProgressLogger.create(getClass(), counter); progress.start();// www . ja v a 2 s . co m DbSession session = db.openSession(false); try { Migration45Mapper mapper = session.getMapper(Migration45Mapper.class); List<RuleParameter> templateRuleParams = mapper.selectAllTemplateRuleParameters(); Multimap<Integer, RuleParameter> templateRuleParamsByRuleId = ArrayListMultimap.create(); for (RuleParameter templateRuleParam : templateRuleParams) { templateRuleParamsByRuleId.put(templateRuleParam.getRuleId(), templateRuleParam); } List<Rule> customRules = mapper.selectAllCustomRules(); Multimap<Integer, Integer> customRuleIdsByTemplateRuleId = HashMultimap.create(); for (Rule customRule : customRules) { customRuleIdsByTemplateRuleId.put(customRule.getTemplateId(), customRule.getId()); } List<RuleParameter> customRuleParams = mapper.selectAllCustomRuleParameters(); Multimap<Integer, RuleParameter> customRuleParamsByRuleId = ArrayListMultimap.create(); for (RuleParameter customRuleParam : customRuleParams) { customRuleParamsByRuleId.put(customRuleParam.getRuleId(), customRuleParam); } // For each parameters of template rules, verify that each custom rules has the parameter for (Integer templateRuleId : templateRuleParamsByRuleId.keySet()) { for (RuleParameter templateRuleParam : templateRuleParamsByRuleId.get(templateRuleId)) { // Each custom rule should have this parameter insertCustomRuleParameterIfNotAlreadyExisting(templateRuleParam, templateRuleId, customRuleIdsByTemplateRuleId, customRuleParamsByRuleId, session); } } session.commit(); // log the total number of process rows progress.log(); } finally { session.close(); progress.stop(); } }
From source file:org.sonar.java.se.checks.RedundantAssignmentsCheck.java
@Override public void init(MethodTree methodTree, CFG cfg) { assignmentsByMethod.push(ArrayListMultimap.create()); }
From source file:com.github.rinde.logistics.pdptw.mas.comm.AuctionTimeStatsLogger.java
/** * @return A multimap of {@link Bidder}s to {@link SolverTimeMeasurement}s. *//*w w w .j a va2 s . c om*/ public ImmutableListMultimap<Bidder<?>, SolverTimeMeasurement> getTimeMeasurements() { final ListMultimap<Bidder<?>, SolverTimeMeasurement> map = ArrayListMultimap.create(); for (final Bidder<DoubleBid> b : bidders) { if (b instanceof Measurable) { map.putAll(b, ((Measurable) b).getTimeMeasurements()); } } return ImmutableListMultimap.copyOf(map); }
From source file:net.shibboleth.idp.profile.logic.SimpleAttributePredicate.java
/** Constructor. */ public SimpleAttributePredicate() { super(); attributeValueMap = ArrayListMultimap.create(); }
From source file:uk.ac.ebi.metabolomes.webservices.eutils.ELinkXMLResponseParser.java
/** * Parses the LinkSetBlock of ELink query response. * //w ww . j a v a 2s . c o m * @param in the input stream through which the response the response can be read. * @return multimap with the mappings from the XML. * @throws javax.xml.stream.XMLStreamException */ public Multimap<String, String> parseLinkSetBlock(InputStream in) throws XMLStreamException { XMLInputFactory2 xmlif = (XMLInputFactory2) XMLInputFactory2.newInstance(); xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); xmlif.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE); xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); xmlif.configureForSpeed(); XMLStreamReader2 xmlr = (XMLStreamReader2) xmlif.createXMLStreamReader(in); int event; ListMultimap<String, String> multiMap = ArrayListMultimap.create(); while (xmlr.hasNext()) { event = xmlr.next(); switch (event) { case XMLEvent.START_DOCUMENT: break; case XMLEvent.START_ELEMENT: if (xmlr.getLocalName().equalsIgnoreCase("LinkSet")) { multiMap.putAll(parseLinkSetEntry(xmlr)); } break; } } xmlr.closeCompletely(); return multiMap; }
From source file:org.zalando.logbook.servlet.TeeRequest.java
@Override public Multimap<String, String> getHeaders() { final Multimap<String, String> headers = ArrayListMultimap.create(); final UnmodifiableIterator<String> iterator = forEnumeration(getHeaderNames()); while (iterator.hasNext()) { final String header = iterator.next(); addAll(headers.get(header), forEnumeration(getHeaders(header))); }/*www. j av a 2s. co m*/ return headers; }
From source file:net.shibboleth.idp.saml.impl.profile.SpringAwareMessageEncoderFactory.java
/** Constructor. */ public SpringAwareMessageEncoderFactory() { bindingMap = ArrayListMultimap.create(); }
From source file:org.shaf.core.process.handle.EmulatorMultiMapHandler.java
@SuppressWarnings("unchecked") @Override/*from w w w .j a va 2 s . co m*/ public Object run() throws ProcessException { try { Class<?>[] mcls = new Class<?>[0]; for (String input : super.config.getInputAsArray()) { mcls = ObjectArrays.concat(mcls, DynamicClassLoader.getClassByName(input.split("\\;")[1])); } ListMultimap<Object, Object> buffer = ArrayListMultimap.create(); for (int i = 0; i < mcls.length; i++) { FileReader.setPathIndex(super.job.getConfiguration(), i); try (RecordReader<Object, Object> reader = RecordReaderFactory .<Object, Object, Object, Object, Object, Object>createRecordReader( (Class<? extends DistributedProcess<Object, Object, Object, Object, Object, Object>>) mcls[i], super.job.getConfiguration());) { buffer.putAll(super.doMapping(reader, (Class<? extends DistributedProcess<Object, Object, Object, Object, Object, Object>>) mcls[i])); } catch (Exception exc) { throw new Exception("Fialed to emulate the map process.", exc); } } try (RecordWriter<Object, Object> writer = RecordWriterFactory.createRecordWriter( (Class<? extends DistributedProcess<Object, Object, Object, Object, Object, Object>>) super.cls, super.job.getConfiguration());) { super.doReducing(buffer, writer); } catch (Exception exc) { throw new Exception("Fialed to emulate the reduce process.", exc); } return null; } catch (Exception exc) { throw new ProcessExecException("Failed to emulate the map-reduce process in multi-mapping mode.", exc); } }
From source file:ezbake.replay.ReplayBroadcaster.java
@Override protected void prepare(Properties props, String groupId) { broadcasted = ArrayListMultimap.create(); }