List of usage examples for java.util Collections unmodifiableSortedSet
public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s)
From source file:com.michelin.cio.hudson.plugins.rolestrategy.RoleMap.java
/** * Get all the sids referenced in this {@link RoleMap}. * @param includeAnonymous True if you want the {@code Anonymous} sid to be included in the set * @return A sorted set containing all the sids *///from www . j a v a2 s . c o m public SortedSet<String> getSids(Boolean includeAnonymous) { TreeSet<String> sids = new TreeSet<String>(); for (Map.Entry entry : this.grantedRoles.entrySet()) { sids.addAll((Set) entry.getValue()); } // Remove the anonymous sid if asked to if (!includeAnonymous) { sids.remove("anonymous"); } return Collections.unmodifiableSortedSet(sids); }
From source file:net.sourceforge.subsonic.service.SearchService.java
/** * Returns all genres in the music collection. * * @return Sorted set of genres./*w w w . j a v a 2 s . com*/ * @throws IOException If an I/O error occurs. */ public Set<String> getGenres() throws IOException { if (!isIndexCreated() || isIndexBeingCreated()) { return Collections.emptySet(); } // Ensure that index is read to memory. getIndex(); return Collections.unmodifiableSortedSet(cachedGenres); }
From source file:org.jahia.services.templates.TemplatePackageRegistry.java
public Set<ModuleVersion> getAvailableVersionsForModule(String moduleNameOrId) { if (packagesWithVersionById.containsKey(moduleNameOrId)) { Set<ModuleVersion> moduleVersions = packagesWithVersionById.get(moduleNameOrId).keySet(); // the returned set might or might not be a SortedSet instance, depending on the JDK (Sun == SortedSet, IBM == something else) if (moduleVersions instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<ModuleVersion>) moduleVersions); } else {// ww w . j av a 2 s. c om return Collections.unmodifiableSortedSet(new TreeSet<ModuleVersion>(moduleVersions)); } } if (packagesWithVersionByName.containsKey(moduleNameOrId)) { Set<ModuleVersion> moduleVersions = packagesWithVersionByName.get(moduleNameOrId).keySet(); // the returned set might or might not be a SortedSet instance, depending on the JDK (Sun == SortedSet, IBM == something else) if (moduleVersions instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<ModuleVersion>) moduleVersions); } else { return Collections.unmodifiableSortedSet(new TreeSet<ModuleVersion>(moduleVersions)); } } return Collections.emptySet(); }
From source file:org.apache.tephra.hbase.txprune.DataJanitorState.java
@Nullable private TimeRegions getNextSetOfTimeRegions(Table stateTable, long time) throws IOException { byte[] timeBytes = Bytes.toBytes(getInvertedTime(time)); Scan scan = new Scan(makeTimeRegionKey(timeBytes, EMPTY_BYTE_ARRAY), REGION_TIME_KEY_PREFIX_STOP); scan.addColumn(FAMILY, REGION_TIME_COL); long currentRegionTime = -1; SortedSet<byte[]> regions = new TreeSet<>(Bytes.BYTES_COMPARATOR); Result next;/*from w ww . jav a 2 s .com*/ try (ResultScanner scanner = stateTable.getScanner(scan)) { while ((next = scanner.next()) != null) { Map.Entry<Long, byte[]> timeRegion = getTimeRegion(next.getRow()); // Stop if reached next time value if (currentRegionTime == -1) { currentRegionTime = timeRegion.getKey(); } else if (timeRegion.getKey() < currentRegionTime) { break; } else if (timeRegion.getKey() > currentRegionTime) { throw new IllegalStateException( String.format("Got out of order time %d when expecting time less than or equal to %d", timeRegion.getKey(), currentRegionTime)); } regions.add(timeRegion.getValue()); } } return regions.isEmpty() ? null : new TimeRegions(currentRegionTime, Collections.unmodifiableSortedSet(regions)); }
From source file:org.jasig.portlet.emailpreview.service.SimpleServiceBroker.java
public void setServices(Map<String, IEmailAccountService> services) { this.services = services; this.protocols = Collections.unmodifiableSortedSet(new TreeSet<String>(services.keySet())); }
From source file:org.eclipse.skalli.commons.Statistics.java
public SortedSet<UserInfo> getUserInfo() { return Collections.unmodifiableSortedSet(users); }
From source file:org.isatools.tablib.export.graph2tab.LayersBuilder.java
/** * Exposes the layer nodes to the world, the returned set is unmodifiable. *///from w ww . j a v a2s. com public SortedSet<Node> getLayerNodes(int layer) { if (!isInitialized) computeTypedLayers(); return Collections.unmodifiableSortedSet(layer2Nodes.get(layer)); }
From source file:org.apereo.portal.portlets.portletadmin.PortletDefinitionForm.java
public SortedSet<JsonEntityBean> getPrincipals() { return Collections.unmodifiableSortedSet(principals); }
From source file:org.glite.security.voms.admin.persistence.model.VOMSUser.java
public Set getGroups() { SortedSet res = new TreeSet(); Iterator mIter = getMappings().iterator(); while (mIter.hasNext()) { VOMSMapping m = (VOMSMapping) mIter.next(); if (m.isGroupMapping()) res.add(m.getGroup());/*w w w .jav a2 s . c om*/ } return Collections.unmodifiableSortedSet(res); }