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:fr.esiea.windmeal.service.search.elasticsearch.implementation.ElasticsearchProviderService.java
private Iterable<FoodProvider> search(String index, String searchingTerms, String... field) { SearchResponse response = esClient.prepareSearch(index).setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(QueryBuilders.multiMatchQuery(searchingTerms, field)).setFrom(0).setSize(20) .setExplain(true).execute().actionGet(); SearchHit[] docs = response.getHits().getHits(); if (docs.length == 0) return Collections.EMPTY_LIST;//No Result ArrayList<FoodProvider> foodProviders = new ArrayList<FoodProvider>(); for (SearchHit doc : docs) { String id = doc.getId();/*from w w w . j a v a 2 s .c o m*/ try { FoodProvider provider = providerDao.getOne(id); foodProviders.add(provider); } catch (DaoException e) { String message = "there is a mismatching between items in the dao and elasticsearch for the id " + id; LOGGER.error(message); throw new RuntimeException(message); } } return foodProviders; }
From source file:com.kelveden.karma.AbstractStartMojo.java
protected List<String> valueToKarmaArgument(final String value, final String argName) { if (value == null) { return Collections.EMPTY_LIST; }/*from w w w . j a va 2 s.c om*/ return Arrays.asList(argName, value); }
From source file:com.photon.phresco.framework.validators.EnvironmentValidator.java
public List<String> getAppliesTo() throws PhrescoException { return Collections.EMPTY_LIST; }
From source file:com.greenline.hrs.admin.user.service.UserInfoService.java
/** * ?????// ww w.j a va 2s .c om * * @param offset ??? * @param size ?? * @return , ??list. */ public List<UserNormalInfo> getUserInfoList(int offset, int size) { List<UserNickName> userNickNames = userNickNameBiz.getList(offset, size); if (userNickNames.isEmpty()) { return Collections.EMPTY_LIST; } Map<Long, UserNormalInfo> userNormalInfoMap = new HashMap<Long, UserNormalInfo>(userNickNames.size() * 2); List<Long> userIds = new ArrayList<Long>(userNickNames.size() * 2); List<UserNormalInfo> userNormalInfos = new ArrayList<UserNormalInfo>(userNickNames.size() * 2); UserNormalInfo userNormalInfo = null; for (UserNickName userNickName : userNickNames) { //?nickName?normalInfo userNormalInfo = new UserNormalInfo(); userNormalInfo.setUid(userNickName.getUid()); userNormalInfo.setNickName(userNickName.getNickName()); userIds.add(userNickName.getUid()); //normalInfoMap userNormalInfoMap.put(userNickName.getUid(), userNormalInfo); } //??,GC userNickNames.clear(); List<UserBasicInfo> userBasicInfos = userBasicInfoBiz.getUserList(userIds); for (UserBasicInfo userBasicInfo : userBasicInfos) { //?uid??? userNormalInfo = userNormalInfoMap.get(userBasicInfo.getUid()); BeanUtils.copyProperties(userBasicInfo, userNormalInfo); userNormalInfos.add(userNormalInfo); } //??,GC userBasicInfos.clear(); userNormalInfoMap.clear(); return userNormalInfos; }
From source file:com.nextep.datadesigner.dbgm.services.DBGMHelper.java
/** * Retrieves the collection of all foreign key constraints which reference * the specified unique key constraint.// w w w .ja va 2 s.c om * * @param uk * the unique key constraint * @return a collection of {@link ForeignKeyConstraint} <i>fk</i> which * match the following condition:<br> * fk.getRemoteConstraint() == uk * @throws ReferenceNotFoundException * when the unique key cannot be located in the current view. */ @SuppressWarnings("unchecked") public static Collection<ForeignKeyConstraint> getForeignKeys(UniqueKeyConstraint uk, boolean repository) throws ReferenceNotFoundException { if (uk == null) return Collections.EMPTY_LIST; // Retrieving table in repository IBasicTable repositoryTable = null; if (repository) { repositoryTable = (IBasicTable) CorePlugin.getService(IReferenceManager.class) .findByTypeName(uk.getConstrainedTable().getType(), uk.getConstrainedTable().getName()); } else { repositoryTable = uk.getConstrainedTable(); } UniqueKeyConstraint repositoryUK = null; for (IKeyConstraint repoUK : repositoryTable.getConstraints()) { switch (repoUK.getConstraintType()) { case PRIMARY: case UNIQUE: // Name based match because we might have non-repository unique // keys here if (repoUK.getName().equals(uk.getName())) { repositoryUK = (UniqueKeyConstraint) repoUK; } break; } } if (repositoryUK != null) { Collection<IReferencer> dependencies = CorePlugin.getService(IReferenceManager.class) .getReverseDependencies(repositoryUK); List<ForeignKeyConstraint> foreignConstraints = new ArrayList<ForeignKeyConstraint>(); for (IReferencer r : dependencies) { if (r instanceof ForeignKeyConstraint) { foreignConstraints.add((ForeignKeyConstraint) r); } } return foreignConstraints; } else { return Collections.EMPTY_LIST; } }
From source file:com.wiiyaya.framework.provider.repository.revision.BaseRevisionDaoImpl.java
@SuppressWarnings("unchecked") public Revisions<N, T> findRevisions(ID id) { Class<T> type = entityInformation.getJavaType(); AuditReader reader = AuditReaderFactory.get(entityManager); List<? extends Number> revisionNumbers = reader.getRevisions(type, id); return revisionNumbers.isEmpty() ? new Revisions<N, T>(Collections.EMPTY_LIST) : getEntitiesForRevisions((List<N>) revisionNumbers, id, reader); }
From source file:de.micromata.tpsb.doc.ParserContext.java
public MethodInfo findMethodInfo(final String className, final String methodName) { FileInfo fileInfo = getFileInfo(className); return fileInfo.findMethodInfo(methodName, Collections.EMPTY_LIST); }
From source file:com.elasticbox.jenkins.k8s.cfg.PluginInitializer.java
@Initializer(after = InitMilestone.JOB_LOADED) public static void checkLocalKubernetesCloud() { LOGGER.info(NAME_PREFIX + "Checking if running inside a Kubernetes Cloud (Auto-discovery)..."); final String kubernetesAddr = System.getenv(KUBERNETES_API_SERVER_ADDR); final String kubernetesAddrPort = System.getenv(KUBERNETES_API_SERVER_PORT); if (PluginHelper.anyOfThemIsBlank(kubernetesAddr, kubernetesAddrPort)) { LOGGER.info(NAME_PREFIX + "Not running inside a Kubernetes Cloud."); return;/* w ww . j av a2 s. c om*/ } String kubernetesUri = "https://" + kubernetesAddr + ":" + kubernetesAddrPort; LOGGER.info(NAME_PREFIX + "Kubernetes Cloud found! Checking if local Kubernetes cloud is configured at: " + kubernetesUri); final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { return; } if (jenkins.getCloud(LOCAL_CLOUD_NAME) != null) { LOGGER.info(NAME_PREFIX + "Local Kubernetes Cloud already configured."); return; } try { if (!kubeRepository.testConnection(kubernetesUri)) { LOGGER.warning(NAME_PREFIX + "No valid Local Kubernetes Cloud connection obtained."); return; } final ChartRepositoryConfig chartRepositoryConfig = new ChartRepositoryConfig(DEFAULT_HELM_CHART_REPO, DEFAULT_HELM_CHART_REPO_URL, StringUtils.EMPTY); final PodSlaveConfig defaultPodSlaveConfig = getDefaultPodSlaveConfig(); String credentialsId = checkLocalKubernetesToken(); final KubernetesCloud cloud = new KubernetesCloud(LOCAL_CLOUD_NAME, LOCAL_CLOUD_NAME, kubernetesUri, DEFAULT_NAMESPACE, MAX_SLAVES, credentialsId, StringUtils.EMPTY, Collections.singletonList(chartRepositoryConfig), (defaultPodSlaveConfig != null) ? Collections.singletonList(defaultPodSlaveConfig) : Collections.EMPTY_LIST); LOGGER.info(NAME_PREFIX + "Adding local Kubernetes Cloud configuration: " + cloud); jenkins.clouds.add(cloud); jenkins.setNumExecutors(0); } catch (RepositoryException exception) { LOGGER.log(Level.SEVERE, NAME_PREFIX + exception.getCausedByMessages(), exception); } catch (IOException excep) { LOGGER.log(Level.SEVERE, NAME_PREFIX + "Error setting number of executors in master to 0.", excep); } }
From source file:com.github.dactiv.orm.core.PageRequest.java
/** * ??.// w w w . j a v a 2 s . co m */ @SuppressWarnings("unchecked") public List<Sort> getSort() { if (orderBy == null || orderDir == null) { return Collections.EMPTY_LIST; } String[] orderBys = StringUtils.split(orderBy, ','); String[] orderDirs = StringUtils.split(orderDir, ','); Assert.isTrue(orderBys.length == orderDirs.length, "???,????"); List<Sort> orders = new ArrayList<PageRequest.Sort>(); for (int i = 0; i < orderBys.length; i++) { orders.add(new Sort(orderBys[i], orderDirs[i])); } return orders; }
From source file:com.eryansky.common.orm.core.PageRequest.java
/** * ??.//w w w . j a v a2 s.c o m */ @SuppressWarnings("unchecked") public List<Sort> getSort() { if (orderBy == null || orderDir == null) { return Collections.EMPTY_LIST; } String[] orderBys = StringUtils.split(orderBy, ','); String[] orderDirs = StringUtils.split(orderDir, ','); Assert.isTrue(orderBys.length == orderDirs.length, "???,????"); List<Sort> orders = new ArrayList<Sort>(); for (int i = 0; i < orderBys.length; i++) { orders.add(new Sort(orderBys[i], orderDirs[i])); } return orders; }