Java Code Examples for com.google.common.collect.ImmutableSet.Builder#addAll()
The following examples show how to use
com.google.common.collect.ImmutableSet.Builder#addAll() .
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: SupportedOptions.java From Mixin with MIT License | 6 votes |
/** * Return all supported options */ public static Set<String> getAllOptions() { Builder<String> options = ImmutableSet.<String>builder(); options.add( SupportedOptions.TOKENS, SupportedOptions.OUT_REFMAP_FILE, SupportedOptions.DISABLE_TARGET_VALIDATOR, SupportedOptions.DISABLE_TARGET_EXPORT, SupportedOptions.DISABLE_OVERWRITE_CHECKER, SupportedOptions.OVERWRITE_ERROR_LEVEL, SupportedOptions.DEFAULT_OBFUSCATION_ENV, SupportedOptions.DEPENDENCY_TARGETS_FILE, SupportedOptions.MAPPING_TYPES, SupportedOptions.PLUGIN_VERSION ); options.addAll( ObfuscationServices.getInstance().getSupportedOptions() ); return options.build(); }
Example 2
Source File: CumulusNcluConfiguration.java From batfish with Apache License 2.0 | 6 votes |
private void convertLoopback() { Optional.ofNullable(_interfaces.get(LOOPBACK_INTERFACE_NAME)) .ifPresent(iface -> populateLoInInterfacesToLoopback(iface, _loopback)); org.batfish.datamodel.Interface newIface = createVIInterfaceForLo(); if (!_loopback.getAddresses().isEmpty()) { newIface.setAddress(_loopback.getAddresses().get(0)); } Builder<ConcreteInterfaceAddress> allAddresses = ImmutableSet.builder(); allAddresses.addAll(_loopback.getAddresses()); if (_loopback.getClagVxlanAnycastIp() != null) { // Just assume CLAG is correctly configured and comes up allAddresses.add( ConcreteInterfaceAddress.create( _loopback.getClagVxlanAnycastIp(), Prefix.MAX_PREFIX_LENGTH)); } newIface.setAllAddresses(allAddresses.build()); _c.getAllInterfaces().put(LOOPBACK_INTERFACE_NAME, newIface); }
Example 3
Source File: CodecsImpl.java From bgpcep with Eclipse Public License 1.0 | 5 votes |
public CodecsImpl(final RIBSupport<?, ?, ?, ?> ribSupport) { this.ribSupport = requireNonNull(ribSupport); final Builder<Class<? extends BindingObject>> acb = ImmutableSet.builder(); acb.addAll(ATTRIBUTE_CACHEABLES); acb.addAll(this.ribSupport.cacheableAttributeObjects()); this.cacheableAttributes = acb.build(); }
Example 4
Source File: PresentSpotRequestsAndInstances.java From attic-stratos with Apache License 2.0 | 5 votes |
protected Set<RunningInstance> getSpots(Set<RegionAndName> regionAndIds) { Builder<RunningInstance> builder = ImmutableSet.<RunningInstance> builder(); Multimap<String, String> regionToSpotIds = transformValues(index(regionAndIds, regionFunction()), nameFunction()); for (Map.Entry<String, Collection<String>> entry : regionToSpotIds.asMap().entrySet()) { String region = entry.getKey(); Collection<String> spotIds = entry.getValue(); logger.trace("looking for spots %s in region %s", spotIds, region); builder.addAll(transform( client.getSpotInstanceApi().get().describeSpotInstanceRequestsInRegion(region, toArray(spotIds, String.class)), spotConverter)); } return builder.build(); }
Example 5
Source File: JSONEncoder.java From arctic-sea with Apache License 2.0 | 4 votes |
public JSONEncoder(EncoderKey... keys) { Builder<EncoderKey> set = ImmutableSet.builder(); set.addAll(Arrays.asList(keys)); this.encoderKeys = set.build(); }
Example 6
Source File: JSONEncoder.java From arctic-sea with Apache License 2.0 | 4 votes |
public JSONEncoder(Class<? super T> type, EncoderKey... additionalKeys) { Builder<EncoderKey> set = ImmutableSet.builder(); set.add(new JSONEncoderKey(type)); set.addAll(Arrays.asList(additionalKeys)); this.encoderKeys = set.build(); }
Example 7
Source File: FilteringSchemaContextProxy.java From yangtools with Eclipse Public License 1.0 | 4 votes |
/** * Filters SchemaContext for yang modules. * * @param delegate original SchemaContext * @param rootModules modules (yang schemas) to be available and all their dependencies (modules importing * rootModule and whole chain of their imports) * @param additionalModuleIds (additional) modules (yang schemas) to be available and whole chain of their imports */ public FilteringSchemaContextProxy(final SchemaContext delegate, final Collection<ModuleId> rootModules, final Set<ModuleId> additionalModuleIds) { requireNonNull(rootModules, "Base modules cannot be null."); requireNonNull(additionalModuleIds, "Additional modules cannot be null."); final Builder<Module> filteredModulesBuilder = new Builder<>(); // preparing map to get all modules with one name but difference in revision final TreeMultimap<String, Module> nameToModulesAll = TreeMultimap.create(String::compareTo, REVISION_COMPARATOR); nameToModulesAll.putAll(getStringModuleMap(delegate)); // in case there is a particular dependency to view filteredModules/YANG models dependency is checked // for module name and imports processForRootModules(delegate, rootModules, filteredModulesBuilder); // adding additional modules processForAdditionalModules(delegate, additionalModuleIds, filteredModulesBuilder); filteredModulesBuilder.addAll(getImportedModules( Maps.uniqueIndex(delegate.getModules(), ModuleId.MODULE_TO_MODULE_ID::apply), filteredModulesBuilder.build(), nameToModulesAll)); /** * Instead of doing this on each invocation of getModules(), pre-compute it once and keep it around. */ final List<Module> sortedModules = new ArrayList<>(filteredModulesBuilder.build()); sortedModules.sort(NAME_REVISION_COMPARATOR); this.filteredModules = ImmutableSet.copyOf(sortedModules); final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(new TreeMap<>(), AbstractSchemaContext::createModuleSet); final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(new TreeMap<>(), AbstractSchemaContext::createModuleSet); final ImmutableMap.Builder<QNameModule, Module> moduleMapBuilder = ImmutableMap.builder(); for (final Module module : filteredModules) { nameMap.put(module.getName(), module); nsMap.put(module.getNamespace(), module); moduleMapBuilder.put(module.getQNameModule(), module); } namespaceToModules = ImmutableSetMultimap.copyOf(nsMap); nameToModules = ImmutableSetMultimap.copyOf(nameMap); moduleMap = moduleMapBuilder.build(); }
Example 8
Source File: FilteringSchemaContextProxy.java From yangtools with Eclipse Public License 1.0 | 4 votes |
private static void processForAdditionalModules(final SchemaContext delegate, final Set<ModuleId> additionalModuleIds, final Builder<Module> filteredModulesBuilder) { filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(), module -> selectAdditionalModules(module, additionalModuleIds))); }
Example 9
Source File: FilteringSchemaContextProxy.java From yangtools with Eclipse Public License 1.0 | 4 votes |
private void processForRootModules(final SchemaContext delegate, final Collection<ModuleId> rootModules, final Builder<Module> filteredModulesBuilder) { filteredModulesBuilder.addAll(Collections2.filter(delegate.getModules(), module -> checkModuleDependency(module, rootModules))); }