List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:org.fim.util.FileStateUtil.java
public static ListMultimap<FileHash, FileState> buildFileHashList(Collection<FileState> fileStates) { ListMultimap<FileHash, FileState> fileHashMap = ArrayListMultimap.create(); for (FileState fileState : fileStates) { fileHashMap.put(fileState.getFileHash(), fileState); }//w w w . j a va 2 s .co m return fileHashMap; }
From source file:org.dspace.search.IndexingTask.java
void addStream(String name, InputStream stream) { if (streams == null) { streams = ArrayListMultimap.create(); } streams.put(name, stream); }
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 ww. ja va 2 s.c o m*/ this.delegate = out.asMap(); this.messages = messages; }
From source file:com.tomtom.camera.api.v2.TranscodingCapabilitiesV2.java
TranscodingCapabilitiesV2(ArrayList<TranscodingCapabilityV2> transcodingCapabilities) { mInputOutputVideoQualityMultimap = ArrayListMultimap.create(); for (TranscodingCapabilityV2 transcodingCapabilityV2 : transcodingCapabilities) { mInputOutputVideoQualityMultimap.put( new VideoQualitySetting(transcodingCapabilityV2.getInputResolution(), transcodingCapabilityV2.getInputFramerate()), new VideoQualitySetting(transcodingCapabilityV2.getOutputResolution(), transcodingCapabilityV2.getOutputFramerate())); }//from ww w .j av a 2s .c om }
From source file:org.bitbucket.es4gwt.shared.elastic.filter.FilterBuilder.java
public FilterBuilder() { this.terms = ArrayListMultimap.create(); }
From source file:de.tuberlin.dima.cuttlefish.preprocessing.parsing.NewsItemXmlParser.java
public static NewsItem toNewsItem(InputStream xml) throws Exception { Document doc = DB_FACTORY.newDocumentBuilder().parse(xml); doc.getDocumentElement().normalize(); String title = textContentOrEmptyString(doc, "title"); String headline = textContentOrEmptyString(doc, "headline"); String text = textContentOrEmptyString(doc, "text"); String dateline = textContentOrEmptyString(doc, "dateline"); Node newsItemNode = doc.getElementsByTagName("newsitem").item(0); int itemID = Integer.parseInt(newsItemNode.getAttributes().getNamedItem("itemid").getNodeValue()); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date date = df.parse(newsItemNode.getAttributes().getNamedItem("date").getNodeValue()); Multimap<String, String> codes = ArrayListMultimap.create(); NodeList codesNodes = doc.getElementsByTagName("codes"); int numCodes = codesNodes.getLength(); for (int codesIndex = 0; codesIndex < numCodes; codesIndex++) { Node codesNode = codesNodes.item(codesIndex); String codeClass = codesNode.getAttributes().getNamedItem("class").getNodeValue(); NodeList codeNodes = codesNode.getChildNodes(); for (int codeIndex = 0; codeIndex < codeNodes.getLength(); codeIndex++) { if ("code".equals(codeNodes.item(codeIndex).getNodeName())) { String codeValue = codeNodes.item(codeIndex).getAttributes().getNamedItem("code") .getNodeValue(); codes.put(codeClass, codeValue); }/* w ww . j av a2 s . c o m*/ } } Map<String, String> dcs = Maps.newHashMap(); NodeList dcNodes = doc.getElementsByTagName("dc"); int numDcs = dcNodes.getLength(); for (int index = 0; index < numDcs; index++) { String dcElement = dcNodes.item(index).getAttributes().getNamedItem("element").getNodeValue(); String dcValue = dcNodes.item(index).getAttributes().getNamedItem("value").getNodeValue(); dcs.put(dcElement, dcValue); } return new NewsItem(itemID, date, title, headline, text, dateline, codes, dcs); }
From source file:org.robotframework.ide.eclipse.main.plugin.validation.CheckstyleReportingStrategy.java
CheckstyleReportingStrategy(final boolean shouldPanic, final String reportFilepath, final Logger logger) { super(shouldPanic); this.logger = logger; this.reportFilepath = reportFilepath; this.numberOfProblems = 0; this.problems = ArrayListMultimap.create(); }
From source file:org.sonar.api.batch.MockSensorContext.java
private Multimap<Resource, Measure> getMeasures() { if (measures == null) { measures = ArrayListMultimap.create(); } return measures; }
From source file:eu.cloudwave.wp5.monitoring.tracing.TraceStorage.java
private TraceStorage() { this.storage = ArrayListMultimap.create(); }
From source file:com.celebihacker.ml.preprocess.rcv1.indexing.parsing.XmlToNewsItemParser.java
public static NewsItem toNewsItem(InputStream xml) throws Exception { Document doc = DB_FACTORY.newDocumentBuilder().parse(xml); doc.getDocumentElement().normalize(); Node newsItemNode = doc.getElementsByTagName("newsitem").item(0); int itemID = Integer.parseInt(newsItemNode.getAttributes().getNamedItem("itemid").getNodeValue()); String title = textContentOrEmptyString(doc, "title"); String headline = textContentOrEmptyString(doc, "headline"); String text = textContentOrEmptyString(doc, "text"); String dateline = textContentOrEmptyString(doc, "dateline"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date date = df.parse(newsItemNode.getAttributes().getNamedItem("date").getNodeValue()); Multimap<String, String> codes = ArrayListMultimap.create(); NodeList codesNodes = doc.getElementsByTagName("codes"); int numCodes = codesNodes.getLength(); for (int codesIndex = 0; codesIndex < numCodes; codesIndex++) { Node codesNode = codesNodes.item(codesIndex); String codeClass = codesNode.getAttributes().getNamedItem("class").getNodeValue(); NodeList codeNodes = codesNode.getChildNodes(); for (int codeIndex = 0; codeIndex < codeNodes.getLength(); codeIndex++) { if ("code".equals(codeNodes.item(codeIndex).getNodeName())) { String codeValue = codeNodes.item(codeIndex).getAttributes().getNamedItem("code") .getNodeValue(); codes.put(codeClass, codeValue); }//from w ww . j a v a 2 s .c o m } } Map<String, String> dcs = Maps.newHashMap(); NodeList dcNodes = doc.getElementsByTagName("dc"); int numDcs = dcNodes.getLength(); for (int index = 0; index < numDcs; index++) { String dcElement = dcNodes.item(index).getAttributes().getNamedItem("element").getNodeValue(); String dcValue = dcNodes.item(index).getAttributes().getNamedItem("value").getNodeValue(); dcs.put(dcElement, dcValue); } if (NewsItemV2Patcher.patch(codes)) return new NewsItem(itemID, date, title, headline, text, dateline, codes, dcs); return null; }