List of usage examples for java.util Collections unmodifiableSet
public static <T> Set<T> unmodifiableSet(Set<? extends T> s)
From source file:net.brtly.monkeyboard.plugin.core.PluginManager.java
public Set<String> getDelegatesIDs() { // TODO return Collections.unmodifiableSet(_delegates.keySet()); }
From source file:org.web4thejob.web.panel.DefaultModelHierarchyPanel.java
@Override public Set<CommandEnum> getSupportedCommands() { Set<CommandEnum> supported = new HashSet<CommandEnum>(super.getSupportedCommands()); supported.add(CommandEnum.REFRESH);/*from w ww . ja v a2s .co m*/ supported.add(CommandEnum.SELECT); return Collections.unmodifiableSet(supported); }
From source file:com.playhaven.android.data.DataCollectionField.java
/** * Unavailable in <11, so copied in. Difference is that names are not re-encoded in UTF-8. * // w w w . ja v a 2 s . c om * Returns a set of the unique names of all query parameters. Iterating * over the set will return the names in order of their first occurrence. * * @throws UnsupportedOperationException if this isn't a hierarchical URI * * @return a set of decoded names */ public static Set<String> getQueryParameterNames(Uri uri) { String query = uri.getEncodedQuery(); if (query == null) { return Collections.emptySet(); } Set<String> names = new LinkedHashSet<String>(); int start = 0; do { int next = query.indexOf('&', start); int end = (next == -1) ? query.length() : next; int separator = query.indexOf('=', start); if (separator > end || separator == -1) { separator = end; } String name = query.substring(start, separator); names.add(name); // Move start to end of name. start = end + 1; } while (start < query.length()); return Collections.unmodifiableSet(names); }
From source file:org.n52.io.request.RequestParameterSet.java
public Set<String> availableParameterNames() { return Collections.unmodifiableSet(this.parameters.keySet()); }
From source file:org.alfresco.bm.test.Test.java
/** * Set a comma-separated string of capabilities. These are tags and can be or represent anything. *//*from w w w . ja v a 2s . c o m*/ public void setSystemCapabilities(String capabilitiesStr) { if (capabilitiesStr == null) { throw new IllegalArgumentException("Capabilities string cannot be null."); } Set<String> capabilitiesTmp = new HashSet<String>(5); StringTokenizer st = new StringTokenizer(capabilitiesStr, ","); while (st.hasMoreTokens()) { String capability = st.nextToken().trim().toLowerCase(); capabilitiesTmp.add(capability); } // Prevent later modification this.systemCapabilities = Collections.unmodifiableSet(capabilitiesTmp); }
From source file:com.hp.autonomy.aci.content.database.Databases.java
/** * {@link Iterator} for the database names. Removing elements is not currently supported. * * @return A suitable iterator// ww w. j av a 2 s .c om */ @Override public Iterator<String> iterator() { // For now we disable removal return Collections.unmodifiableSet(values).iterator(); }
From source file:jenkins.plugins.git.GitSCMSourceContext.java
@NonNull public Collection<RefNameMapping> getRefNameMappings() { if (refNameMappings == null) { return Collections.emptySet(); } else {/*from w w w .ja v a2 s. c om*/ return Collections.unmodifiableSet(refNameMappings); } }
From source file:com.opensymphony.xwork2.ognl.OgnlUtil.java
@Inject(value = XWorkConstants.OGNL_EXCLUDED_PACKAGE_NAMES, required = false) public void setExcludedPackageNames(String commaDelimitedPackageNames) { excludedPackageNames = Collections .unmodifiableSet(TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackageNames)); }
From source file:net.kaleidos.mapping.i18n.UrlMappingsHolderFactoryBean.java
public void afterPropertiesSet() throws Exception { Assert.state(applicationContext != null, "Property [applicationContext] must be set!"); Assert.state(grailsApplication != null, "Property [grailsApplication] must be set!"); List urlMappings = new ArrayList(); List excludePatterns = new ArrayList(); GrailsClass[] mappings = grailsApplication.getArtefacts(UrlMappingsArtefactHandler.TYPE); final DefaultUrlMappingEvaluator defaultUrlMappingEvaluator = new DefaultUrlMappingEvaluator( (WebApplicationContext) applicationContext); defaultUrlMappingEvaluator.setPluginManager(pluginManager); UrlMappingEvaluator mappingEvaluator = defaultUrlMappingEvaluator; if (mappings.length == 0) { urlMappings.addAll(mappingEvaluator.evaluateMappings(DefaultUrlMappings.getMappings())); } else {/*from ww w . j a v a 2s . com*/ for (GrailsClass mapping : mappings) { GrailsUrlMappingsClass mappingClass = (GrailsUrlMappingsClass) mapping; List grailsClassMappings; if (Script.class.isAssignableFrom(mappingClass.getClass())) { grailsClassMappings = mappingEvaluator.evaluateMappings(mappingClass.getClazz()); } else { grailsClassMappings = mappingEvaluator.evaluateMappings(mappingClass.getMappingsClosure()); } urlMappings.addAll(grailsClassMappings); if (mappingClass.getExcludePatterns() != null) { excludePatterns.addAll(mappingClass.getExcludePatterns()); } } } DefaultUrlMappingsHolder defaultUrlMappingsHolder = new DefaultUrlMappingsHolder(urlMappings, excludePatterns, true); // Implementing UrlMapping i18n // create mappingNameSet to access from DefaultLinkGenerator Set<String> mappingNameSetAux = new HashSet<String>(); for (Object mapping : urlMappings) { String mappingName = ((UrlMapping) mapping).getMappingName(); if (mappingName != null) { mappingNameSetAux.add(mappingName); } } mappingNameSet = Collections.unmodifiableSet(mappingNameSetAux); Map flatConfig = grailsApplication.getFlatConfig(); Integer cacheSize = mapGetInteger(flatConfig, URL_MAPPING_CACHE_MAX_SIZE); if (cacheSize != null) { defaultUrlMappingsHolder.setMaxWeightedCacheCapacity(cacheSize); } Integer urlCreatorCacheSize = mapGetInteger(flatConfig, URL_CREATOR_CACHE_MAX_SIZE); if (urlCreatorCacheSize != null) { defaultUrlMappingsHolder.setUrlCreatorMaxWeightedCacheCapacity(urlCreatorCacheSize); } // call initialize() after settings are in place defaultUrlMappingsHolder.initialize(); urlMappingsHolder = defaultUrlMappingsHolder; }
From source file:eu.openanalytics.rsb.config.PersistedConfigurationAdapter.java
@Override public Map<String, Set<URI>> getApplicationSpecificRserviPoolUris() { final Map<String, ?> sourcePoolUris = persistedConfiguration.getApplicationSpecificRserviPoolUris(); if ((sourcePoolUris == null) || (sourcePoolUris.isEmpty())) { return Collections.emptyMap(); }/*from w w w . j av a 2s .co m*/ final Map<String, Set<URI>> applicationSpecificRserviPoolUris = new HashMap<String, Set<URI>>(); for (final Entry<String, ?> sourcePoolUri : sourcePoolUris.entrySet()) { if (sourcePoolUri.getValue() instanceof String) { applicationSpecificRserviPoolUris.put(sourcePoolUri.getKey(), Collections.singleton(Util.newURI((String) sourcePoolUri.getValue()))); } else { // assuming array of string, will die otherwise @SuppressWarnings("unchecked") final Collection<String> urisForOneApplication = (Collection<String>) sourcePoolUri.getValue(); final Set<URI> uris = new HashSet<URI>(); for (final String uri : urisForOneApplication) { uris.add(Util.newURI(uri)); } applicationSpecificRserviPoolUris.put(sourcePoolUri.getKey(), Collections.unmodifiableSet(uris)); } } return applicationSpecificRserviPoolUris; }