List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:cern.jarrace.controller.rest.controller.AgentContainerControllerTest.java
@Test public void testListWithNoAgentContainers() throws Exception { Set<AgentContainer> containers = Collections.emptySet(); when(agentContainerManager.findAllAgentContainers()).thenReturn(containers); mockMvc.perform(get(JARRACE_CONTAINER_LIST_PATH)).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().json(getJson(containers))); }
From source file:com.nflabs.shiro.cache.zookeeper.ZookeeperCache.java
@Override public Collection<V> values() { if (!isBaseDirectoryExist()) { LOG.debug("The Zookeeper base dir doesnt exist, abort."); return Collections.emptySet(); }/* w w w .j a va 2 s. c o m*/ try { @SuppressWarnings("unchecked") List<K> childrens = (List<K>) zookeeperClient.getChildren(zookeeperBasePath, null); if (!CollectionUtils.isEmpty(childrens)) { List<V> values = new ArrayList<V>(childrens.size()); for (K key : childrens) { V value = get(key); if (value != null) { values.add(value); } } return Collections.unmodifiableList(values); } else { return Collections.emptyList(); } } catch (InterruptedException | KeeperException e) { //throw new CacheException(e); LOG.error("Error: {}", e.getMessage()); return Collections.emptyList(); } }
From source file:com.myGengo.alfresco.polling.MyGengoPollingJob.java
private Map<MyGengoAccount, Collection<NodeRef>> getMyGengoJobs() { final Map<MyGengoAccount, Collection<NodeRef>> myGengoJobs = new HashMap<MyGengoAccount, Collection<NodeRef>>(); AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() { public Void doWork() { executeWithinTransaction();/*from www .j a va2s .co m*/ return null; } private void executeWithinTransaction() { transactionService.getRetryingTransactionHelper() .doInTransaction(new RetryingTransactionCallback<Void>() { public Void execute() throws Exception { for (NodeRef myGengoContainerRef : getMyGengoContainers()) { Set<NodeRef> jobRefs = Collections.emptySet(); MyGengoAccount accountInfo; try { accountInfo = accountService.refreshAccountInfo(myGengoContainerRef); } catch (MyGengoServiceException e) { logger.error("unable to refresh account info", e); return null; } jobRefs = MyGengoUtils.getMyGengoJobs(myGengoContainerRef, nodeService); myGengoJobs.put(accountInfo, jobRefs); } return null; } }); } }, runAsUser); return myGengoJobs; }
From source file:org.grails.datastore.mapping.model.config.DefaultMappingConfigurationStrategy.java
public Set getOwningEntities(Class javaClass, MappingContext context) { return Collections.emptySet(); }
From source file:spring.AbstractIntegrationTests.java
protected Collection<? extends HttpMessageConverter<?>> getAdditionalConverters() { return Collections.emptySet(); }
From source file:hr.fer.zemris.vhdllab.service.impl.WorkspaceServiceImpl.java
/** * Resolves a hierarchy tree for specified file. Resolved hierarchy trees * gets added to <code>resolvedNodes</code> parameter. * //from w w w . j a v a 2s. c o m * @param file * a file for whom to resolve hierarchy tree * @param resolvedNodes * contains hierarchy tree for all resolved files */ private void resolveHierarchy(File file, Map<File, HierarchyNode> resolvedNodes) { /* * This method resolves a hierarchy by recursively invoking itself. */ Set<String> dependencies; try { dependencies = metadataExtractor.extractDependencies(file); } catch (Exception e) { LOG.error("Error during extraction of hierarchy", e); dependencies = Collections.emptySet(); } for (String name : dependencies) { File dep = findProjectOrPredefinedFile(file.getProject().getId(), name); if (dep == null) { resolvedNodes.get(file).addMissingDependency(name); continue; } HierarchyNode parent = resolvedNodes.get(file); if (resolvedNodes.containsKey(dep)) { HierarchyNode depNode = resolvedNodes.get(dep); parent.addDependency(depNode); } else { HierarchyNode depNode = new HierarchyNode(dep, parent); resolvedNodes.put(dep, depNode); resolveHierarchy(dep, resolvedNodes); } } }
From source file:com.espertech.esper.epl.join.table.PropertySortedEventTable.java
public Collection<EventBean> lookupRangeInvertedColl(Object keyStart, boolean includeStart, Object keyEnd, boolean includeEnd) { if (keyStart == null || keyEnd == null) { return Collections.emptySet(); }/*www. j a va 2 s. c o m*/ keyStart = coerce(keyStart); keyEnd = coerce(keyEnd); SortedMap<Object, Set<EventBean>> submapOne = propertyIndex.headMap(keyStart, !includeStart); SortedMap<Object, Set<EventBean>> submapTwo = propertyIndex.tailMap(keyEnd, !includeEnd); return normalizeCollection(submapOne, submapTwo); }
From source file:ca.uhn.fhir.jpa.term.BaseHapiTerminologySvc.java
@Transactional(propagation = Propagation.REQUIRED) @Override//from w ww . j av a 2 s.c o m public Set<TermConcept> findCodesAbove(Long theCodeSystemResourcePid, Long theCodeSystemVersionPid, String theCode) { Stopwatch stopwatch = Stopwatch.createStarted(); TermConcept concept = fetchLoadedCode(theCodeSystemResourcePid, theCodeSystemVersionPid, theCode); if (concept == null) { return Collections.emptySet(); } Set<TermConcept> retVal = new HashSet<TermConcept>(); retVal.add(concept); fetchParents(concept, retVal); ourLog.info("Fetched {} codes above code {} in {}ms", new Object[] { retVal.size(), theCode, stopwatch.elapsed(TimeUnit.MILLISECONDS) }); return retVal; }
From source file:lodsve.core.condition.OnBeanCondition.java
private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) throws LinkageError { try {//from ww w . ja v a2s .com Set<String> result = new LinkedHashSet<String>(); collectBeanNamesForType(result, beanFactory, ClassUtils.forName(type, classLoader), considerHierarchy); return result; } catch (ClassNotFoundException ex) { return Collections.emptySet(); } }
From source file:org.eclipse.virgo.ide.manifest.internal.core.BundleManifestManager.java
/** * {@inheritDoc}/* ww w.j av a 2 s. co m*/ */ public Set<String> getPackageExports(IJavaProject javaProject) { try { r.lock(); if (bundles.containsKey(javaProject)) { BundleManifest bundleManifest = bundles.get(javaProject); if (bundleManifest.getExportPackage() != null && bundleManifest.getExportPackage().getExportedPackages() != null) { Set<String> packageExports = new LinkedHashSet<String>(); for (ExportedPackage packageExport : bundleManifest.getExportPackage().getExportedPackages()) { packageExports.add(packageExport.getPackageName()); } return packageExports; } } return Collections.emptySet(); } finally { r.unlock(); } }