List of usage examples for com.google.common.collect HashMultimap create
public static <K, V> HashMultimap<K, V> create()
From source file:com.willowtreeapps.saguaro.plugin.LicenseUtil.java
public static HashMultimap<String, LicenseDependency> toMultiMap(Set<LicenseDependency> licenseDependencies) { HashMultimap<String, LicenseDependency> licenseMap = HashMultimap.create(); for (LicenseDependency dependency : licenseDependencies) { for (LicenseInfo license : dependency.getLicenses()) { licenseMap.put(license.getKey(), dependency); }/* w w w. j a v a 2s . c o m*/ } return licenseMap; }
From source file:org.apache.kylin.invertedindex.util.IIDictionaryBuilder.java
public static Dictionary<?>[] buildDictionary(List<List<String>> table, IIDesc desc) throws IOException { HashMultimap<TblColRef, String> valueMap = HashMultimap.create(); final List<TblColRef> allColumns = desc.listAllColumns(); for (List<String> row : table) { for (int i = 0; i < row.size(); i++) { String cell = row.get(i); if (!desc.isMetricsCol(i)) { valueMap.put(allColumns.get(i), cell); }//from w w w . ja va 2s . c o m } } Dictionary<?>[] result = new Dictionary<?>[allColumns.size()]; for (TblColRef tblColRef : valueMap.keySet()) { final Collection<byte[]> bytes = Collections2.transform(valueMap.get(tblColRef), new Function<String, byte[]>() { @Nullable @Override public byte[] apply(String input) { return input == null ? null : input.getBytes(); } }); final Dictionary<?> dict = DictionaryGenerator.buildDictionary(tblColRef.getType(), new IterableDictionaryValueEnumerator(bytes)); result[desc.findColumn(tblColRef)] = dict; } return result; }
From source file:eu.itesla_project.cases.EntsoeCaseRepositoryConfig.java
static EntsoeCaseRepositoryConfig load(String moduleConfigName, PlatformConfig platformConfig, Collection<String> supportedFormats) { ModuleConfig config = platformConfig.getModuleConfig(moduleConfigName); Path rootDir = config.getPathProperty("rootDir"); Multimap<UcteGeographicalCode, String> forbiddenFormatsByCountry = HashMultimap.create(); for (UcteGeographicalCode geographicalCode : UcteGeographicalCode.values()) { List<String> forbiddenFormats = config.getStringListProperty("forbiddenFormats_" + geographicalCode, Collections.emptyList()); if (forbiddenFormats.size() > 0) { forbiddenFormatsByCountry.putAll(geographicalCode, forbiddenFormats); }//from www. j a v a 2 s. c o m } return new EntsoeCaseRepositoryConfig(rootDir, checkedFormats(forbiddenFormatsByCountry, supportedFormats)); }
From source file:eu.itesla_project.entsoe.cases.EntsoeCaseRepositoryConfig.java
static EntsoeCaseRepositoryConfig load(String moduleConfigName, PlatformConfig platformConfig, Collection<String> supportedFormats) { ModuleConfig config = platformConfig.getModuleConfig(moduleConfigName); Path rootDir = config.getPathProperty("rootDir"); Multimap<EntsoeGeographicalCode, String> forbiddenFormatsByCountry = HashMultimap.create(); for (EntsoeGeographicalCode geographicalCode : EntsoeGeographicalCode.values()) { List<String> forbiddenFormats = config.getStringListProperty("forbiddenFormats_" + geographicalCode, Collections.emptyList()); if (forbiddenFormats.size() > 0) { forbiddenFormatsByCountry.putAll(geographicalCode, forbiddenFormats); }//from w w w . j a v a2s.c om } return new EntsoeCaseRepositoryConfig(rootDir, checkedFormats(forbiddenFormatsByCountry, supportedFormats)); }
From source file:uk.ac.ebi.intact.dataexchange.psimi.solr.params.UrlSolrParams.java
private static Multimap<String, String> getQueryMap(String query) { String[] params = query.split("&"); Multimap<String, String> map = HashMultimap.create(); for (String param : params) { String name = param.split("=")[0]; String value = param.split("=")[1]; map.put(name, value);/*from www . java 2 s. c o m*/ } return map; }
From source file:cuchaz.enigma.convert.ClassForest.java
public ClassForest(ClassIdentifier identifier) { m_identifier = identifier; m_forest = HashMultimap.create(); }
From source file:co.cask.cdap.data2.metadata.lineage.LineageCollapser.java
/** * Collapse {@link Relation}s based on {@link CollapseType} * @param relations lineage relations//w w w. j ava 2s .c o m * @param collapseTypes fields to collapse relations on * @return collapsed relations */ public static Set<CollapsedRelation> collapseRelations(Iterable<Relation> relations, Set<CollapseType> collapseTypes) { Set<CollapsedRelation> collapsedRelations = new HashSet<>(); Multimap<CollapseKey, Relation> multimap = HashMultimap.create(); for (Relation relation : relations) { multimap.put(getCollapseKey(relation, collapseTypes), relation); } LOG.trace("Collapsed relations: {}", multimap.asMap()); for (Map.Entry<CollapseKey, Collection<Relation>> collapsedEntry : multimap.asMap().entrySet()) { Id.NamespacedId data = collapsedEntry.getKey().data; Id.Program program = collapsedEntry.getKey().program; Set<AccessType> accessTypes = new HashSet<>(); Set<RunId> runs = new HashSet<>(); Set<Id.NamespacedId> components = new HashSet<>(); for (Relation relation : collapsedEntry.getValue()) { accessTypes.add(relation.getAccess()); runs.add(relation.getRun()); components.addAll(relation.getComponents()); } collapsedRelations.add(toCollapsedRelation(data, program, accessTypes, runs, components)); } return collapsedRelations; }
From source file:com.kylinolap.common.restclient.MultiValueCache.java
public MultiValueCache(Broadcaster.TYPE syncType) { super(syncType); innerCache = HashMultimap.create(); }
From source file:io.soliton.shapeshifter.ProtoDescriptorGraph.java
public static ProtoDescriptorGraph of(Descriptor descriptor) { Multimap<Descriptor, Descriptor> graphBuilder = HashMultimap.create(); populate(descriptor, graphBuilder);//from w w w .j a v a2 s . c om return new ProtoDescriptorGraph( ImmutableMultimap.<Descriptor, Descriptor>builder().putAll(graphBuilder).build()); }
From source file:io.apiman.manager.ui.client.local.util.MultimapUtil.java
/** * Creates an empty {@link Multimap}./*from w ww .j a v a2s. c om*/ */ public static final Multimap<String, String> emptyMap() { return HashMultimap.create(); }