List of usage examples for com.google.common.collect ImmutableMultimap.Builder put
@Deprecated @Override public boolean put(K key, V value)
From source file:com.spectralogic.ds3client.networking.HeadersImpl.java
private static ImmutableMultimap<String, String> toMultiMap(final Header[] headers) { final ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder(); for (final Header header : headers) { builder.put(header.getName().toLowerCase(), header.getValue()); }//from w ww.j a va 2s . c o m return builder.build(); }
From source file:com.facebook.buck.android.exopackage.ExopackageUtil.java
public static ImmutableMultimap<Path, Path> applyFilenameFormat(Multimap<String, Path> filesToHashes, Path deviceDir, String filenameFormat) { ImmutableMultimap.Builder<Path, Path> filesBuilder = ImmutableMultimap.builder(); for (Map.Entry<String, Path> entry : filesToHashes.entries()) { filesBuilder.put(deviceDir.resolve(String.format(filenameFormat, entry.getKey())), entry.getValue()); }//w w w. j a va 2 s . com return filesBuilder.build(); }
From source file:pt.ua.tm.neji.core.parser.ParserSupport.java
private static void generateGDepMap() { ImmutableMultimap.Builder<ParserLanguage, ParserLevel> builder = ImmutableMultimap.builder(); builder.put(ParserLanguage.ENGLISH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.ENGLISH, ParserLevel.POS); builder.put(ParserLanguage.ENGLISH, ParserLevel.CHUNKING); builder.put(ParserLanguage.ENGLISH, ParserLevel.LEMMATIZATION); builder.put(ParserLanguage.ENGLISH, ParserLevel.DEPENDENCY); supportMaps.put(ParserTool.GDEP, builder.build()); }
From source file:pt.ua.tm.neji.core.parser.ParserSupport.java
private static void generateOpenNLPMap() { ImmutableMultimap.Builder<ParserLanguage, ParserLevel> builder = ImmutableMultimap.builder(); builder.put(ParserLanguage.DANISH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.DANISH, ParserLevel.POS); builder.put(ParserLanguage.DUTCH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.DUTCH, ParserLevel.POS); builder.put(ParserLanguage.ENGLISH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.ENGLISH, ParserLevel.POS); builder.put(ParserLanguage.ENGLISH, ParserLevel.CHUNKING); builder.put(ParserLanguage.FRENCH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.FRENCH, ParserLevel.POS); builder.put(ParserLanguage.FRENCH, ParserLevel.CHUNKING); builder.put(ParserLanguage.GERMAN, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.GERMAN, ParserLevel.POS); builder.put(ParserLanguage.PORTUGUESE, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.PORTUGUESE, ParserLevel.POS); builder.put(ParserLanguage.SWEDISH, ParserLevel.TOKENIZATION); builder.put(ParserLanguage.SWEDISH, ParserLevel.POS); supportMaps.put(ParserTool.OPENNLP, builder.build()); }
From source file:org.zalando.logbook.QueryParameters.java
public static QueryParameters parse(@Nullable final String queryString) { if (queryString == null || queryString.isEmpty()) { return EMPTY; }// ww w . j a v a2 s. c o m final ImmutableMultimap.Builder<String, String> entries = ImmutableMultimap.builder(); for (final Map.Entry<String, String> entry : splitEntries(queryString)) { entries.put(entry.getKey(), entry.getValue()); } return new QueryParameters(entries.build()); }
From source file:com.spectralogic.dsbrowser.gui.services.ds3Panel.DeleteService.java
/** * Delete folder(s)//from ww w .j a v a 2 s . c o m * * @param ds3Common ds3Common object * @param values list of folders to be deleted */ public static void deleteFolders(final Ds3Common ds3Common, final ImmutableList<TreeItem<Ds3TreeTableValue>> values) { LOG.info("Got delete folder event"); final Ds3PanelPresenter ds3PanelPresenter = ds3Common.getDs3PanelPresenter(); final Session currentSession = ds3Common.getCurrentSession(); if (currentSession != null) { final ImmutableMultimap.Builder<String, String> deleteFoldersMap = ImmutableMultimap.builder(); values.forEach(folder -> { deleteFoldersMap.put(folder.getValue().getBucketName(), folder.getValue().getFullName()); }); final Ds3DeleteFoldersTask deleteFolderTask = new Ds3DeleteFoldersTask(currentSession.getClient(), deleteFoldersMap.build()); DeleteFilesPopup.show(deleteFolderTask, ds3Common); ds3PanelPresenter.getDs3PathIndicator().setText(StringConstants.EMPTY_STRING); ds3PanelPresenter.getDs3PathIndicatorTooltip().setText(StringConstants.EMPTY_STRING); } }
From source file:org.tensorics.core.tensor.operations.OngoingMapOut.java
private static <T, C, C1 extends C> Multimap<Set<?>, Entry<Position, T>> groupBy( Iterable<Entry<Position, T>> entries, Class<C1> dimension) { ImmutableMultimap.Builder<Set<?>, Entry<Position, T>> fullEntriesBuilder = ImmutableMultimap.builder(); for (Entry<Position, T> entry : entries) { Collection<?> coordinates = entry.getKey().coordinates(); fullEntriesBuilder.put(OngoingMapOut.coordinatesExcept(coordinates, dimension), entry); }//from ww w . jav a 2 s. co m return fullEntriesBuilder.build(); }
From source file:eu.eubrazilcc.lvl.core.entrez.GbFlatFileHelper.java
/** * Infers the possible countries of the species from which the DNA sequence was obtained and * returns a map of Java {@link Locale} where the key of the map is the GenBank field that was * used to infer the country. The country is inferred from the annotations of the GenBank file * format, using the fields in the following order: * <ol>// ww w. ja v a2 s .co m * <li>If a /country entry exists in the FEATURES of the file, then this is returned to * the caller and no other check is performed;</li> * <li>DEFINITION;</li> * <li>TITLE; or</li> * <li>Check PUBMED title and abstract fields.</li> * </ol> * Java {@link Locale} allows latter to export the country to several different formats, including a * two-letter code compatible with ISO 3166-1 alpha-2 standard. * @param file - sequence file. * @return a Java {@link Locale} inferred from the sequence file. * @throws Exception if an error occurs. */ public static final ImmutableMultimap<GenBankField, Locale> inferCountry(final File file) throws Exception { checkArgument(file != null && file.canRead(), "Uninitialized or invalid file"); final ImmutableMultimap.Builder<GenBankField, Locale> builder = new ImmutableMultimap.Builder<GenBankField, Locale>(); // infer from features final Locale locale = getLocale(countryFeature(file)); if (locale != null) { builder.put(GenBankField.COUNTRY_FEATURE, locale); } else { // infer from definition // TODO // infer from title // TODO // infer from PubMed title and abstract fields // TODO } return builder.build(); }
From source file:com.spotify.heroic.ExtraParameters.java
public static ExtraParameters ofList(final List<String> input) { final ImmutableMultimap.Builder<String, String> result = ImmutableMultimap.builder(); for (final String entry : input) { final int index = entry.indexOf('='); if (index < 0) { result.put(entry, ""); } else {//ww w . jav a 2s . com result.put(entry.substring(0, index), entry.substring(index + 1)); } } return new ExtraParameters(ImmutableList.of(), result.build()); }
From source file:org.jetbrains.android.inspections.XmlWrongFileTypeInspection.java
@NotNull public static ImmutableCollection<ResourceFolderType> determineResourceFolderTypeByRootTag( @NotNull AndroidFacet facet, @NotNull String tagName) { if (ourResourceFolderTypeMap == null) { // First time calling the function, need to initialize the map first final ImmutableMultimap.Builder<String, ResourceFolderType> builder = ImmutableMultimap.builder(); for (String tag : AndroidAnimationUtils.getPossibleRoots()) { builder.put(tag, ResourceFolderType.ANIM); }// ww w. java 2 s . c o m for (String tag : AndroidAnimatorUtil.getPossibleRoots()) { builder.put(tag, ResourceFolderType.ANIMATOR); } for (String tag : AndroidXmlResourcesUtil.getPossibleRoots(facet)) { builder.put(tag, ResourceFolderType.XML); } for (String tag : AndroidDrawableDomUtil.getPossibleRoots(facet)) { builder.put(tag, ResourceFolderType.DRAWABLE); } for (String tag : TransitionDomUtil.getPossibleRoots()) { builder.put(tag, ResourceFolderType.TRANSITION); } ourResourceFolderTypeMap = builder.build(); } return ourResourceFolderTypeMap.get(tagName); }