Java Code Examples for com.google.common.collect.ListMultimap#values()
The following examples show how to use
com.google.common.collect.ListMultimap#values() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractResourceRepository.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Returns the sorted list of languages used in the resources. */ @NonNull public SortedSet<String> getLanguages() { SortedSet<String> set = new TreeSet<String>(); // As an optimization we could just look for values since that's typically where // the languages are defined -- not on layouts, menus, etc -- especially if there // are no translations for it Set<String> qualifiers = Sets.newHashSet(); synchronized (ITEM_MAP_LOCK) { for (ListMultimap<String, ResourceItem> map : getMap().values()) { for (ResourceItem item : map.values()) { qualifiers.add(item.getQualifiers()); } } } Splitter splitter = Splitter.on('-'); for (String s : qualifiers) { for (String qualifier : splitter.split(s)) { if (qualifier.length() == 2 && Character.isLetter(qualifier.charAt(0)) && Character.isLetter(qualifier.charAt(1))) { set.add(qualifier); } } } return set; }
Example 2
Source File: AbstractResourceRepository.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Returns the sorted list of regions used in the resources with the given language. * @param currentLanguage the current language the region must be associated with. */ @NonNull public SortedSet<String> getRegions(@NonNull String currentLanguage) { SortedSet<String> set = new TreeSet<String>(); // As an optimization we could just look for values since that's typically where // the languages are defined -- not on layouts, menus, etc -- especially if there // are no translations for it Set<String> qualifiers = Sets.newHashSet(); synchronized (ITEM_MAP_LOCK) { for (ListMultimap<String, ResourceItem> map : getMap().values()) { for (ResourceItem item : map.values()) { qualifiers.add(item.getQualifiers()); } } } Splitter splitter = Splitter.on('-'); for (String s : qualifiers) { boolean rightLanguage = false; for (String qualifier : splitter.split(s)) { if (currentLanguage.equals(qualifier)) { rightLanguage = true; } else if (rightLanguage && qualifier.length() == 3 && qualifier.charAt(0) == 'r' && Character.isUpperCase(qualifier.charAt(1)) && Character.isUpperCase(qualifier.charAt(2))) { set.add(qualifier.substring(1)); } } } return set; }
Example 3
Source File: ModuleSplitsToShardMerger.java From bundletool with Apache License 2.0 | 5 votes |
private Collection<ModuleEntry> mergeDexFilesAndCache( ListMultimap<BundleModuleName, ModuleEntry> dexFilesToMergeByModule, BundleMetadata bundleMetadata, AndroidManifest androidManifest, Map<ImmutableSet<ModuleEntry>, ImmutableList<Path>> mergedDexCache) { if (dexFilesToMergeByModule.keySet().size() <= 1) { // Don't merge if all dex files live inside a single module. If that module contains multiple // dex files, it should have been built with multi-dex support. return dexFilesToMergeByModule.values(); } else if (androidManifest.getEffectiveMinSdkVersion() >= Versions.ANDROID_L_API_VERSION) { // When APK targets L+ devices we know the devices already have multi-dex support. // In this case we can skip merging dexes and just rename original ones to be in order. return renameDexFromAllModulesToSingleShard(dexFilesToMergeByModule); } else { ImmutableList<ModuleEntry> dexEntries = ImmutableList.copyOf(dexFilesToMergeByModule.values()); ImmutableList<Path> mergedDexFiles = mergedDexCache.computeIfAbsent( ImmutableSet.copyOf(dexEntries), key -> mergeDexFiles(dexEntries, bundleMetadata, androidManifest)); // Names of the merged dex files need to be preserved ("classes.dex", "classes2.dex" etc.). return mergedDexFiles.stream() .map( filePath -> ModuleEntry.builder() .setPath(DEX_DIRECTORY.resolve(filePath.getFileName().toString())) .setContent(filePath) .build()) .collect(toImmutableList()); } }
Example 4
Source File: AbstractResourceRepository.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the sorted list of languages used in the resources. */ @NonNull public SortedSet<String> getLanguages() { SortedSet<String> set = new TreeSet<String>(); // As an optimization we could just look for values since that's typically where // the languages are defined -- not on layouts, menus, etc -- especially if there // are no translations for it Set<String> qualifiers = Sets.newHashSet(); synchronized (ITEM_MAP_LOCK) { for (ListMultimap<String, ResourceItem> map : getMap().values()) { for (ResourceItem item : map.values()) { qualifiers.add(item.getQualifiers()); } } } for (String s : qualifiers) { FolderConfiguration configuration = FolderConfiguration.getConfigForQualifierString(s); if (configuration != null) { LocaleQualifier locale = configuration.getLocaleQualifier(); if (locale != null) { set.add(locale.getLanguage()); } } } return set; }
Example 5
Source File: AbstractResourceRepository.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the sorted list of languages used in the resources. */ @NonNull public SortedSet<LocaleQualifier> getLocales() { SortedSet<LocaleQualifier> set = new TreeSet<LocaleQualifier>(); // As an optimization we could just look for values since that's typically where // the languages are defined -- not on layouts, menus, etc -- especially if there // are no translations for it Set<String> qualifiers = Sets.newHashSet(); synchronized (ITEM_MAP_LOCK) { for (ListMultimap<String, ResourceItem> map : getMap().values()) { for (ResourceItem item : map.values()) { qualifiers.add(item.getQualifiers()); } } } for (String s : qualifiers) { FolderConfiguration configuration = FolderConfiguration.getConfigForQualifierString(s); if (configuration != null) { LocaleQualifier locale = configuration.getLocaleQualifier(); if (locale != null) { set.add(locale); } } } return set; }
Example 6
Source File: AbstractResourceRepository.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the sorted list of regions used in the resources with the given language. * @param currentLanguage the current language the region must be associated with. */ @NonNull public SortedSet<String> getRegions(@NonNull String currentLanguage) { SortedSet<String> set = new TreeSet<String>(); // As an optimization we could just look for values since that's typically where // the languages are defined -- not on layouts, menus, etc -- especially if there // are no translations for it Set<String> qualifiers = Sets.newHashSet(); synchronized (ITEM_MAP_LOCK) { for (ListMultimap<String, ResourceItem> map : getMap().values()) { for (ResourceItem item : map.values()) { qualifiers.add(item.getQualifiers()); } } } for (String s : qualifiers) { FolderConfiguration configuration = FolderConfiguration.getConfigForQualifierString(s); if (configuration != null) { LocaleQualifier locale = configuration.getLocaleQualifier(); if (locale != null && locale.getRegion() != null && locale.getLanguage().equals(currentLanguage)) { set.add(locale.getRegion()); } } } return set; }
Example 7
Source File: RawResolvedFeatures.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public List<JvmFeature> getAllFeatures() { if (!allFeaturesComputed) { ListMultimap<String, JvmFeature> featureIndex = computeAllFeatures(); for(String simpleName: featureIndex.keySet()) { this.featureIndex.put(simpleName, Lists.newArrayList(featureIndex.get(simpleName))); } allFeaturesComputed = true; } List<JvmFeature> result = Lists.newArrayList(); for(List<JvmFeature> list: featureIndex.values()) { result.addAll(list); } return result; }
Example 8
Source File: AMLBlockProcessor.java From sailfish-core with Apache License 2.0 | 4 votes |
public static ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames) throws AMLException { AlertCollector alertCollector = new AlertCollector(); List<AMLTestCase> testCases = allBlocks.get(AMLBlockType.TestCase); List<AMLTestCase> blocks = allBlocks.get(AMLBlockType.Block); List<AMLTestCase> beforeTCBlocks = allBlocks.get(AMLBlockType.BeforeTCBlock); List<AMLTestCase> afterTCBlocks = allBlocks.get(AMLBlockType.AfterTCBlock); List<AMLTestCase> firstBlocks = allBlocks.get(AMLBlockType.FirstBlock); List<AMLTestCase> lastBlocks = allBlocks.get(AMLBlockType.LastBlock); List<AMLTestCase> globalBlocks = allBlocks.get(AMLBlockType.GlobalBlock); retainExecutableTestCases(testCases, settings); if(testCases.isEmpty()) { alertCollector.add(new Alert("Nothing to execute")); } checkBlockReferences(testCases, alertCollector); checkBlockReferences(blocks, alertCollector); checkBlockReferences(beforeTCBlocks, alertCollector); checkBlockReferences(afterTCBlocks, alertCollector); insertGlobalBlocks(testCases, globalBlocks, alertCollector); insertFirstAndLastBlocks(testCases, firstBlocks, lastBlocks); Set<String> invalidBlockReferences = getRecursiveBlockReferences(blocks, alertCollector); insertIncludeBlocks(testCases, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames); insertIncludeBlocks(beforeTCBlocks, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames); insertIncludeBlocks(afterTCBlocks, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames); copyStaticActions(testCases, AMLLangConst.AML2.matches(settings.getLanguageURI()), alertCollector); setLastOutcomes(testCases); ListMultimap<AMLBlockType, AMLTestCase> processedBlocks = ArrayListMultimap.create(); processedBlocks.putAll(AMLBlockType.TestCase, testCases); processedBlocks.putAll(AMLBlockType.BeforeTCBlock, beforeTCBlocks); processedBlocks.putAll(AMLBlockType.AfterTCBlock, afterTCBlocks); for(AMLTestCase testCase : allBlocks.values()) { for(AMLAction action : testCase.getActions()) { List<String> dependencies = action.getDependencies(); if(dependencies.isEmpty()) { continue; } for(String dependency : dependencies) { AMLAction dependencyAction = testCase.findActionByRef(dependency); if(dependencyAction == null) { String reference = ObjectUtils.defaultIfNull(action.getReference(), action.getReferenceToFilter()); alertCollector.add(new Alert(action.getLine(), reference, Column.Dependencies.getName(), "Dependency on unknown action: " + dependency)); } if(dependencyAction == action) { alertCollector.add(new Alert(action.getLine(), dependency, Column.Dependencies.getName(), "Action cannot depend on itself")); } } } } if(alertCollector.getCount(AlertType.ERROR) > 0) { throw new AMLException("Failed to process blocks", alertCollector); } return processedBlocks; }