List of usage examples for java.util Collections unmodifiableSet
public static <T> Set<T> unmodifiableSet(Set<? extends T> s)
From source file:ddf.catalog.data.impl.MetacardTypeImpl.java
public Set<AttributeDescriptor> add(AttributeDescriptor descriptor) { if (descriptor != null) { this.descriptors.put(descriptor.getName(), descriptor); }// ww w.j av a 2s . co m return Collections.unmodifiableSet(new HashSet<>(this.descriptors.values())); }
From source file:LocaleUtils.java
/** * <p>Obtains an unmodifiable set of installed locales.</p> * /*w w w . j av a2 s. c om*/ * <p>This method is a wrapper around {@link Locale#getAvailableLocales()}. * It is more efficient, as the JDK method must create a new array each * time it is called.</p> * * @return the unmodifiable set of available locales */ public static Set availableLocaleSet() { Set set = cAvailableLocaleSet; if (set == null) { set = new HashSet(availableLocaleList()); set = Collections.unmodifiableSet(set); cAvailableLocaleSet = set; } return set; }
From source file:eu.europa.esig.dss.pdf.PdfDssDict.java
public Set<X509CRL> getCrlList() { return Collections.unmodifiableSet(crlList); }
From source file:com.aionemu.commons.scripting.scriptmanager.ScriptManager.java
/** * Returns unmodifiable set with script contexts * //from w w w .j a v a 2s.co m * @return unmodifiable set of script contexts */ public synchronized Collection<ScriptContext> getScriptContexts() { return Collections.unmodifiableSet(contexts); }
From source file:com.chiorichan.session.Session.java
/** * Get the present data change history// w w w . jav a 2 s .c o m * * @return * A unmodifiable copy of dataChangeHistory. */ Set<String> getChangeHistory() { return Collections.unmodifiableSet(new HashSet<String>(dataChangeHistory)); }
From source file:org.apereo.services.persondir.support.AbstractAggregatingDefaultQueryPersonAttributeDao.java
/** * Iterates through the configured {@link java.util.List} of {@link IPersonAttributeDao} * instances. The results from each DAO are merged into the result {@link Map} * by the configured {@link IAttributeMerger}. * * @see IPersonAttributeDao#getPeopleWithMultivaluedAttributes(java.util.Map) */// w w w . j av a 2s. c om @Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> query) { Validate.notNull(query, "query may not be null."); //Initialize null, so that if none of the sub-DAOs find any people null is returned appropriately Set<IPersonAttributes> resultPeople = null; //Denotes that this is the first time we are running a query and the original seed should be used boolean isFirstQuery = true; if (this.personAttributeDaos == null) { throw new IllegalStateException("personAttributeDaos must be set"); } //Iterate through the configured IPersonAttributeDaos, querying each. for (final IPersonAttributeDao currentlyConsidering : this.personAttributeDaos) { boolean handledException = false; Set<IPersonAttributes> currentPeople = null; try { currentPeople = this.getAttributesFromDao(query, isFirstQuery, currentlyConsidering, resultPeople); isFirstQuery = false; if (this.logger.isDebugEnabled()) { this.logger.debug("Retrieved attributes='" + currentPeople + "' for query='" + query + "', isFirstQuery=" + isFirstQuery + ", currentlyConsidering='" + currentlyConsidering + "', resultAttributes='" + resultPeople + "'"); } } catch (final RuntimeException rte) { handledException |= handleRuntimeException(currentlyConsidering, rte); } if (currentPeople != null) { if (resultPeople == null) { //If this is the first valid result set just use it. resultPeople = new LinkedHashSet<>(currentPeople); } else { //Merge the Sets of IPersons resultPeople = this.attrMerger.mergeResults(resultPeople, currentPeople); } } if (this.stopOnSuccess && !handledException) { if (this.logger.isDebugEnabled()) { this.logger.debug( "Successfully retrieved attributes from a child DAO and stopOnSuccess is true, stopping iteration of child DAOs"); } break; } } if (resultPeople == null) { return null; } if (this.logger.isDebugEnabled()) { this.logger.debug("Aggregated search results '" + resultPeople + "' for query='" + query + "'"); } return Collections.unmodifiableSet(resultPeople); }
From source file:com.netflix.nicobar.core.archive.JarScriptArchive.java
protected JarScriptArchive(ScriptModuleSpec moduleSpec, Path jarPath, String moduleSpecEntry, long createTime) throws IOException { this.createTime = createTime; this.moduleSpec = Objects.requireNonNull(moduleSpec, "moduleSpec"); Objects.requireNonNull(jarPath, "jarFile"); if (!jarPath.isAbsolute()) throw new IllegalArgumentException("jarPath must be absolute."); // initialize the index JarFile jarFile = new JarFile(jarPath.toFile()); Set<String> indexBuilder; try {/*from ww w .ja v a 2s. c o m*/ Enumeration<JarEntry> jarEntries = jarFile.entries(); indexBuilder = new HashSet<String>(); while (jarEntries.hasMoreElements()) { JarEntry jarEntry = jarEntries.nextElement(); // Skip adding moduleSpec to archive entries if (jarEntry.getName().equals(moduleSpecEntry)) { continue; } if (!jarEntry.isDirectory()) { indexBuilder.add(jarEntry.getName()); } } } finally { jarFile.close(); } entryNames = Collections.unmodifiableSet(indexBuilder); rootUrl = jarPath.toUri().toURL(); }
From source file:de.topicmapslab.couchtm.core.AssociationImpl.java
@Override public Set<Role> getRoles() { if (!loaded)// w ww . java2 s. c o m load(); if (mergedIn != null) return mergedIn.getRoles(); return Collections.unmodifiableSet(Converter.setIRoleToRole(roles)); }
From source file:it.geosolutions.tools.io.file.MultiPropertyFile.java
/** * @return the Set of the defined properties. The Set is unmodifiable. * @throws IllegalStateException if {@link #read() read()} has not been yet invoked. *//*from w w w .j a va 2 s . co m*/ public Set<String> getPropertyNames() throws IllegalStateException { checkState(); return Collections.unmodifiableSet(properties.keySet()); }
From source file:com.edmunds.etm.rules.impl.WebConfigurationManager.java
private void buildActiveRuleSet() { // Start with an empty rule set and no applications activated. UrlRuleSet currentRuleSet = new UrlRuleSet(Collections.<UrlRule>emptyList()); final List<String> activatedApplications = Lists.newArrayList(); // Also store any invalid rules final Set<InvalidUrlRule> ignoredRules = Sets.newHashSet(); // Get an ordered list of applications to activate. List<Application> applications = getApplicationActivationOrder(); // Add rules for active applications for (Application application : applications) { if (!application.hasVirtualServer()) { logger.error(String.format("Active application has no virtual server: %s", application.getMavenModule())); continue; }//from w w w . jav a 2 s .c o m UrlRuleSet updatedRuleSet = addRulesForApplication(application, currentRuleSet, ignoredRules); if (updatedRuleSet != null) { currentRuleSet = updatedRuleSet; activatedApplications.add(application.getName()); } } // Deploy active rules activeRules = Collections.unmodifiableSet(currentRuleSet.orderRules()); blockedRules = Collections.unmodifiableSet(currentRuleSet.getBlockedRules()); invalidRules = Collections.unmodifiableSet(ignoredRules); agentConfigurationManager.build(applicationRepository.getActiveApplications(), activeRules); // Store the previous rule activation order. this.previousApplicationActivationOrder = activatedApplications; }