List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:com.adobe.acs.commons.workflow.impl.WorkflowPackageManagerImpl.java
/** * {@inheritDoc}//from w ww . ja va2 s .c o m */ public final List<String> getPaths(final ResourceResolver resourceResolver, final String path, final String[] nodeTypes) throws RepositoryException { final List<String> collectionPaths = new ArrayList<String>(); final Resource resource = resourceResolver.getResource(path); if (resource == null) { log.warn("Requesting paths for a non-existent Resource [ {} ]; returning empty results.", path); return Collections.EMPTY_LIST; } else if (!isWorkflowPackage(resourceResolver, path)) { log.debug("Requesting paths for a non-Resource Collection [ {} ]; returning provided path.", path); return Arrays.asList(new String[] { path }); } else { final PageManager pageManager = resourceResolver.adaptTo(PageManager.class); final Page page = pageManager.getContainingPage(path); if (page != null && page.getContentResource() != null) { final Node node = page.getContentResource().adaptTo(Node.class); final ResourceCollection resourceCollection = ResourceCollectionUtil.getResourceCollection(node, resourceCollectionManager); if (resourceCollection != null) { final List<Node> members = resourceCollection.list(nodeTypes); for (final Node member : members) { collectionPaths.add(member.getPath()); } return collectionPaths; } } return Arrays.asList(new String[] { path }); } }
From source file:uk.ac.ebi.intact.editor.controller.curate.interaction.AbstractParticipantImportController.java
public void importSelected(ActionEvent evt) { getParticipantImportService().getIntactDao().getUserContext().setUser(getCurrentUser()); CvObjectService cvObjectService = getCvService(); if (cvBiologicalRole == null) { cvBiologicalRole = cvObjectService.getDefaultBiologicalRole(); }/*from w w w . j av a 2s .co m*/ initialiseOtherProperties(); if (!isLoadAsMoleculeSet) { for (ImportCandidate candidate : importCandidates) { if (candidate.isSelected()) { T participant = toParticipant(candidate); processAddedParticipant(participant); } } } else if (!importCandidates.isEmpty()) { String query = StringUtils.join(participantsToImport, "_"); IntactInteractorPool newPool = new IntactInteractorPool(query); ImportCandidate firstSelected = new ImportCandidate(query, newPool); for (ImportCandidate candidate : importCandidates) { if (candidate.isSelected()) { if (candidate.isChain() || candidate.isIsoform()) { changesController.markAsHiddenChange(candidate.getInteractor(), null, Collections.EMPTY_LIST, getParticipantImportService().getIntactDao().getSynchronizerContext() .getInteractorSynchronizer(), "Interactor " + candidate.getInteractor().getShortName()); } newPool.add(candidate.getInteractor()); } } if (firstSelected != null) { firstSelected.setInteractor(newPool); T participant = toParticipant(firstSelected); processAddedParticipant(participant); } } doSave(); participantsToImport = new String[0]; // reset load molecule set this.isLoadAsMoleculeSet = false; cvBiologicalRole = cvObjectService.getDefaultBiologicalRole(); resetOtherProperties(); }
From source file:com.microsoft.alm.plugin.idea.git.ui.branch.CreateBranchModelTest.java
@Test public void testConstructor_NoRemotesFound() { when(mockGitRepoInfo.getRemoteBranches()).thenReturn(Collections.EMPTY_LIST); underTest = new CreateBranchModel(mockProject, defaultBranchName, mockGitRepository); assertNotNull(underTest.getRemoteBranchDropdownModel()); assertEquals(0, underTest.getRemoteBranchDropdownModel().getSize()); assertNull(underTest.getSelectedRemoteBranch()); }
From source file:com.sulacosoft.bitcoindconnector4j.BitcoindApiHandler.java
private Object deserializeResult(Method method, Object result) { if (result instanceof MorphDynaBean) { return JSONObject.toBean(JSONObject.fromObject(JSONSerializer.toJSON((MorphDynaBean) result)), method.getReturnType()); } else if (result instanceof List) { List<?> incomingList = (List<?>) result; if (incomingList.size() == 0) return Collections.EMPTY_LIST; ParameterizedType type = (ParameterizedType) method.getGenericReturnType(); // method.getGenericType(); Class<?> clazz = (Class<?>) type.getActualTypeArguments()[0]; ArrayList<Object> outcomingList = new ArrayList<>(); if (incomingList.get(0) instanceof MorphDynaBean) { for (Object entity : incomingList) { Object ent = JSONObject.toBean(JSONObject.fromObject(entity), clazz); outcomingList.add(ent);//from w ww. java2 s . com } } else { outcomingList.addAll(incomingList); } return outcomingList; } else { return result; } }
From source file:com.scaleoutsoftware.soss.hserver.RunMapper.java
@SuppressWarnings("unchecked") public RunMapper(HServerInvocationParameters invocationParameters) throws IOException, ClassNotFoundException, NoSuchMethodException { _logger.debug("Starting mapper. Parameters: " + invocationParameters); this.invocationParameters = invocationParameters; if (invocationParameters.isOldApi()) { mapperWrapper = new MapperWrapperMapred<INKEY, INVALUE, OUTKEY, OUTVALUE>(invocationParameters); } else {/* w w w . j a v a 2 s. co m*/ mapperWrapper = new MapperWrapperMapreduce<INKEY, INVALUE, OUTKEY, OUTVALUE>(invocationParameters); } configuration = (Configuration) invocationParameters.getConfiguration(); invocationId = invocationParameters.getAppId(); //This happens under _jobLock, so we wont interfere with the running tasks runMapContext = new RunHadoopMapContext<OUTKEY, OUTVALUE>( invocationParameters.getHadoopPartitionToSossRegionMapping(), invocationParameters.getAppId(), HServerParameters.getSetting(MAP_OUTPUTCHUNKSIZE_KB, configuration), HServerParameters.getSetting(MAP_HASHTABLESIZE, configuration), HServerParameters.getSetting(MAP_MAXTEMPMEMORY_KB, configuration), mapperWrapper.getMapOutputKeyClass(), mapperWrapper.getMapOutputValueClass(), false, 0, mapperWrapper, mapperWrapper.getPartitioner(), configuration); isSingleResultOptimisation = invocationParameters.isSingleResultOptimisation(); inputSplitList = invocationParameters.getInputSplits(); List<Integer> splitIndexList = null; for (InetAddress address : NetUtils.getLocalInterfaces()) { splitIndexList = ((InvocationParameters<?>) invocationParameters).getInputSplitAssignment() .get(address); if (splitIndexList != null) { //Handle the workload sharing between multiple JVMs //We assume that split list for the IP comes to each JVM in the same order if (InvocationWorker.getNumberOfWorkers() > 1) { int listSize = splitIndexList.size(); int splitsPerHost = Math.max(1, listSize / InvocationWorker.getNumberOfWorkers() + 1); int startIndex = splitsPerHost * InvocationWorker.getIgWorkerIndex(); if (startIndex < listSize) { int stopIndex = Math.min(listSize, startIndex + splitsPerHost); splitIndexList = splitIndexList.subList(startIndex, stopIndex); } else { splitIndexList = Collections.EMPTY_LIST; } _logger.warn("Split list to process:" + splitIndexList + ", ;" + listSize + "," + splitsPerHost + "," + startIndex); } break; } } if (splitIndexList != null && splitIndexList.size() > 0) { //We found our split list numberOfSplits = splitIndexList.size(); splitIndexesForThisHost = new ArrayBlockingQueue<Integer>(numberOfSplits); splitIndexesForThisHost.addAll(splitIndexList); numberOfWorkers = Math.max(1, Math.min(invocationParameters.getNumberOfSlotsPerNode(), splitIndexesForThisHost.size())); } else { //Short circuit the mapper numberOfSplits = 0; splitIndexesForThisHost = null; numberOfWorkers = 0; } //If there is a cap on maximum number of slots, apply it int maxSlots = HServerParameters.getSetting(HServerParameters.MAX_SLOTS, configuration); if (maxSlots > 0) { numberOfWorkers = Math.min(numberOfWorkers, maxSlots); } }
From source file:com.smartitengineering.cms.client.impl.RootResourceImpl.java
@Override public Collection<WorkspaceContentResouce> getWorkspaces() { final Feed feed = getLastReadStateOfEntity(); if (feed == null) { return Collections.EMPTY_LIST; }//from w w w . j a v a 2 s .co m List<Entry> entries = feed.getEntries(); List<WorkspaceContentResouce> list = new ArrayList<WorkspaceContentResouce>(entries.size()); for (Entry entry : entries) { final List<Link> links = entry.getLinks(WorkspaceContentResouce.WORKSPACE_CONTENT); Link link = null; for (Link tmp : links) { if (MediaType.APPLICATION_JSON.equals(tmp.getMimeType().toString())) { link = tmp; } } list.add( new WorkspaceContentResourceImpl(this, AtomClientUtil.convertFromAtomLinkToResourceLink(link))); } return list; }
From source file:com.linkedin.pinot.core.startree.BaseStarTreeIndexTest.java
/** * Helper method to compute the sums using raw index. * @param metricNames// w w w .j av a 2 s . c om * @param brokerRequest */ protected Map<String, double[]> computeSumUsingRawDocs(IndexSegment segment, List<String> metricNames, BrokerRequest brokerRequest) { FilterPlanNode planNode = new FilterPlanNode(segment, brokerRequest); Operator rawOperator = planNode.run(); BlockDocIdIterator rawDocIdIterator = rawOperator.nextBlock().getBlockDocIdSet().iterator(); List<String> groupByColumns = Collections.EMPTY_LIST; if (brokerRequest.isSetAggregationsInfo() && brokerRequest.isSetGroupBy()) { groupByColumns = brokerRequest.getGroupBy().getColumns(); } return computeSum(segment, rawDocIdIterator, metricNames, groupByColumns); }
From source file:de.csw.expertfinder.ExpertFinder.java
/** * Returns the names of all topics that are covered by the underlying domain model. * @return a list containing the names of all topics that are covered by the underlying domain model. *//*from w w w .ja v a 2 s . c om*/ public List<String> getAvailableTopicLabels() { if (applicationState != ApplicationState.INIT_DONE) return Collections.EMPTY_LIST; if (topicLabelsSorted == null) { Set<String> topicLabelsUnsorted = OntologyIndex.get().getAllConceptLabels(); topicLabelsSorted = new ArrayList<String>(topicLabelsUnsorted.size()); topicLabelsSorted.addAll(topicLabelsUnsorted); Collections.sort(topicLabelsSorted); } return topicLabelsSorted; }
From source file:com.redhat.rhn.taskomatic.core.TaskomaticDaemon.java
private boolean isTomcatUp() { boolean toRet = false; try {/* w ww .j a va 2 s . co m*/ XmlRpcClient client = new XmlRpcClient("http://localhost/rpc/api", false); Object obj = client.invoke("api.getVersion", Collections.EMPTY_LIST); if (obj instanceof String) { toRet = true; } } catch (Exception e) { toRet = false; } return toRet; }
From source file:io.seldon.api.state.ZkSubscriptionHandler.java
public Collection<ChildData> getImmediateChildren(String node) { HashSet<ChildData> toReturn = new HashSet<>(); TreeCache cache = findParentCache(node); if (cache == null) return Collections.EMPTY_LIST; Map<String, ChildData> children = cache.getCurrentChildren(node); if (children == null) return toReturn; for (ChildData child : children.values()) toReturn.addAll(getChildren(child.getPath(), cache)); toReturn.addAll(children.values());//from w w w .j av a 2 s. c om return toReturn; }