List of usage examples for java.util Collections unmodifiableSortedSet
public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s)
From source file:gov.nih.nci.caarray.domain.project.Project.java
/** * Get the files.//from ww w .j a va 2s.c o m * * @return the files. */ @Transient public SortedSet<CaArrayFile> getImportedFiles() { return Collections.unmodifiableSortedSet(getImportedFileSet()); }
From source file:org.ihtsdo.otf.snomed.service.ConceptLookUpServiceImpl.java
@Override @Cacheable(value = { "conceptIds" }) public Set<String> getConceptIds(int offset, int limit) throws ConceptServiceException { LOGGER.debug("getting concept ids with offset {} and limit {} ", offset, limit); TreeSet<String> conceptIds = new TreeSet<String>(); TitanGraph g = null;/* www. j av a 2 s .co m*/ try { g = factory.getReadOnlyGraph(); Iterable<Result<Vertex>> vs = g.indexQuery("concept", "v.sctid:*").offset(offset).limit(limit) .vertices(); for (Result<Vertex> v : vs) { String sctid = v.getElement().getProperty(Properties.sctid.toString()); if (!StringUtils.isEmpty(sctid)) { LOGGER.trace("Adding sctid {} to concept id list ", sctid); conceptIds.add(sctid); } } RefsetGraphFactory.commit(g); } catch (Exception e) { LOGGER.error("Error duing concept ids fetch ", e); RefsetGraphFactory.rollback(g); throw new ConceptServiceException(e); } finally { RefsetGraphFactory.shutdown(g); } LOGGER.debug("returning total {} concept ids ", conceptIds.size()); return Collections.unmodifiableSortedSet(conceptIds); }
From source file:gov.nih.nci.caarray.domain.project.Project.java
/** * Get the files.//from w ww . j ava2s . co m * * @return the files. */ @Transient public SortedSet<CaArrayFile> getImportingFiles() { return Collections.unmodifiableSortedSet(getImportingFileSet()); }
From source file:therian.operator.immutablecheck.DefaultImmutableCheckerTest.java
@Test public void testJavaUtilCollectionsFactoryTypes() { assertTrue(//from ww w .j av a2 s . c o m therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyList()))).booleanValue()); assertTrue( therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptySet()))).booleanValue()); assertTrue(therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptySet().iterator()))) .booleanValue()); assertTrue( therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyMap()))).booleanValue()); assertTrue(therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyMap().keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyMap().keySet().iterator()))) .booleanValue()); assertTrue(therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyMap().values()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections.emptyMap().values().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections.unmodifiableList(Collections.emptyList())))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableList(Collections.emptyList()).iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of( Positions.readOnly(Collections.unmodifiableList(Collections.emptyList()).listIterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections.unmodifiableSet(Collections.emptySet())))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableSet(Collections.emptySet()).iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections.unmodifiableMap(Collections.emptyMap())))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableMap(Collections.emptyMap()).keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableMap(Collections.emptyMap()).values()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableMap(Collections.emptyMap()).keySet().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableMap(Collections.emptyMap()).values().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableSortedSet(new TreeSet<String>())))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of( Positions.readOnly(Collections.unmodifiableSortedSet(new TreeSet<String>()).iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedSet(new TreeSet<String>()).headSet("foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedSet(new TreeSet<String>()).tailSet("foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedSet(new TreeSet<String>()).subSet("foo", "foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedSet(new TreeSet<String>()).headSet("foo").iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedSet(new TreeSet<String>()).tailSet("foo").iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedSet(new TreeSet<String>()).subSet("foo", "foo").iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck .of(Positions.readOnly(Collections.unmodifiableSortedMap(new TreeMap<String, Object>())))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).values()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).keySet().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).values().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).headMap("foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).headMap("foo").keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).headMap("foo").values()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).headMap("foo").keySet().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).headMap("foo").values().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions .readOnly(Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).tailMap("foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).tailMap("foo").keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).tailMap("foo").values()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).tailMap("foo").keySet().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).tailMap("foo").values().iterator()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly( Collections.unmodifiableSortedMap(new TreeMap<String, Object>()).subMap("foo", "foo")))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).subMap("foo", "foo").keySet()))) .booleanValue()); assertTrue(therianContext .eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).subMap("foo", "foo").values()))) .booleanValue()); assertTrue(therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).subMap("foo", "foo").keySet().iterator()))) .booleanValue()); assertTrue(therianContext.eval(ImmutableCheck.of(Positions.readOnly(Collections .unmodifiableSortedMap(new TreeMap<String, Object>()).subMap("foo", "foo").values().iterator()))) .booleanValue()); }
From source file:com.flowpowered.commands.Command.java
public Set<CommandFilter> getFilters() { return Collections.unmodifiableSortedSet(this.filters); }
From source file:net.solarnetwork.node.hw.currentcost.CCSupport.java
/** * Get a read-only set of known addresses. * //from ww w .ja v a 2s .c o m * <p> * This will contain all the addresses previously passed to * {@link #addKnownAddress(String)} and that have not been removed via * {@link #clearKnownAddresses(Collection)}. * </p> * * @return a read-only set of known addresses */ protected SortedSet<CCDatum> getKnownAddresses() { return Collections.unmodifiableSortedSet(knownAddresses); }
From source file:org.web4thejob.web.panel.base.AbstractCommandAwarePanel.java
@Override public SortedSet<Command> getCommands() { if (commands != null) { SortedSet<Command> sortedSet = new TreeSet<Command>(COMMANDS_SORTER); sortedSet.addAll(commands.values()); return Collections.unmodifiableSortedSet(sortedSet); } else {/*from w w w .j av a2s.co m*/ return Command.EMPTY_COMMANDS_SET; } }
From source file:org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceCollectionProxyFactoryBean.java
/** * Create the managed-collection given the existing settings. This method creates the osgi managed collection and * wraps it with an unmodifiable map to prevent exposing infrastructure methods and write access. * //from ww w . ja v a 2 s .co m * @return importer proxy */ @SuppressWarnings("unchecked") @Override Object createProxy(boolean lazyProxy) { if (log.isDebugEnabled()) log.debug("Creating a multi-value/collection proxy"); OsgiServiceCollection collection; Collection delegate; BundleContext bundleContext = getBundleContext(); ClassLoader classLoader = getAopClassLoader(); Filter filter = getUnifiedFilter(); boolean useServiceReferences = MemberType.SERVICE_REFERENCE.equals(memberType); if (CollectionType.LIST.equals(collectionType)) { collection = (comparator == null ? new OsgiServiceList(filter, bundleContext, classLoader, proxyCreator, useServiceReferences) : new OsgiServiceSortedList(filter, bundleContext, classLoader, comparator, proxyCreator, useServiceReferences)); delegate = Collections.unmodifiableList((List) collection); } else if (CollectionType.SET.equals(collectionType)) { collection = (comparator == null ? new OsgiServiceSet(filter, bundleContext, classLoader, proxyCreator, useServiceReferences) : new OsgiServiceSortedSet(filter, bundleContext, classLoader, comparator, proxyCreator, useServiceReferences)); delegate = Collections.unmodifiableSet((Set) collection); } else if (CollectionType.SORTED_LIST.equals(collectionType)) { collection = new OsgiServiceSortedList(filter, bundleContext, classLoader, comparator, proxyCreator, useServiceReferences); delegate = Collections.unmodifiableList((List) collection); } else if (CollectionType.SORTED_SET.equals(collectionType)) { collection = new OsgiServiceSortedSet(filter, bundleContext, classLoader, comparator, proxyCreator, useServiceReferences); delegate = Collections.unmodifiableSortedSet((SortedSet) collection); } else { throw new IllegalArgumentException("Unknown collection type:" + collectionType); } // assign the proxy early to avoid multiple collection creation // when calling the listeners proxy = delegate; collection.setRequiredAtStartup(Availability.MANDATORY.equals(getAvailability())); collection.setListeners(getListeners()); collection.setStateListeners(stateListeners); collection.setServiceImporter(this); collection.setServiceImporterName(getBeanName()); collection.setUseBlueprintExceptions(isUseBlueprintExceptions()); // start the lookup only after the proxy has been assembled if (!lazyProxy) { collection.afterPropertiesSet(); } else { final OsgiServiceCollection col = collection; initializationCallback = new Runnable() { public void run() { col.afterPropertiesSet(); } }; } exposedProxy = collection; proxyDestructionCallback = new DisposableBeanRunnableAdapter(collection); return delegate; }
From source file:net.solarnetwork.node.centameter.CentameterSupport.java
/** * Get a read-only set of known addresses. * /*from w w w .j ava 2 s. co m*/ * <p> * This will contain all the addresses previously passed to * {@link #addKnownAddress(String)} and that have not been removed via * {@link #clearKnownAddresses(Collection)}. * </p> * * @return a read-only set of known addresses */ protected SortedSet<CentameterDatum> getKnownAddresses() { return Collections.unmodifiableSortedSet(knownAddresses); }
From source file:gov.nih.nci.caarray.domain.project.Project.java
/** * Get the files./*from ww w .j av a2s . c om*/ * * @return the files. */ @Transient public SortedSet<CaArrayFile> getUnImportedFiles() { return Collections.unmodifiableSortedSet(getUnImportedFileSet()); }