当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtils.isEmpty方法代码示例

本文整理汇总了Java中org.apache.commons.collections4.CollectionUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.isEmpty方法的具体用法?Java CollectionUtils.isEmpty怎么用?Java CollectionUtils.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections4.CollectionUtils的用法示例。


在下文中一共展示了CollectionUtils.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findApplicationFromVm

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
/**
 * Gets the applicationVm's persisted application record.  (Currently require exactly 1.)
 */
private Application findApplicationFromVm(ApplicationVm applicationVm)
{
  List<Application> applications = applicationVm.getApplications();
  if (CollectionUtils.isEmpty(applications))
  {
    throw new IllegalStateException(context(applicationVm.getEnvironment()) + "No application");
  }
  else
  {
    if (applications.size() > 1)
    {
      throw new UnsupportedOperationException(context(applicationVm.getEnvironment())
          + "Currently only support case of 1 application, but applicationVm '"
          + applicationVm.getHostname() + "' has " + applications.size());
    }
    return applications.get(0);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:22,代码来源:TwoEnvLoader.java

示例2: findLogicalDatabaseFromEnvironment

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
/**
 * Gets the env's persisted logicaldb record.  Requires exactly 1.
 */
private LogicalDatabase findLogicalDatabaseFromEnvironment(Environment environment)
{
  List<LogicalDatabase> logicalDatabases = environment.getLogicalDatabases();
  if (CollectionUtils.isEmpty(logicalDatabases))
  {
    throw new IllegalStateException(context(environment) + "No logical databases");
  }
  else if (logicalDatabases.size() > 1)
  {
    throw new UnsupportedOperationException(context(environment) + "Currently only support case of 1 logicalDatabase, but live env has "
        + logicalDatabases.size()); // + ": " + listOfNames(logicalDatabases));
  }
  else if (StringUtils.isBlank(logicalDatabases.get(0).getLogicalName()))
  {
    throw new IllegalStateException(context(environment) + "Logical database has blank name");
  }
  return logicalDatabases.get(0);
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:22,代码来源:TwoEnvLoader.java

示例3: loadCdsNucleatides

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private List<List<Sequence>> loadCdsNucleatides(List<Gene> cdsList, long referenceId, Chromosome chromosome) {
    if (CollectionUtils.isEmpty(cdsList)) {
        return null;
    }

    // Load reference nucleotides for CDS.
    List<List<Sequence>> cdsNucleotides;
    try {
        cdsNucleotides = loadNucleotidesForReferenceCds(chromosome, referenceId, cdsList);
    } catch (IOException e) {
        LOGGER.error("Error during protein sequence reconstruction.", e);
        return null;
    }
    Assert.notNull(cdsNucleotides, "Cannot load nucleotides for cds list.");

    return cdsNucleotides;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:18,代码来源:ProteinSequenceReconstructionManager.java

示例4: verifyAndUpdateJvmStates

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
@Override
@Scheduled(fixedDelayString = "${ping.jvm.period.millis}")
public void verifyAndUpdateJvmStates() {
    final List<Jvm> jvms = jvmPersistenceService.getJvms();
    if (CollectionUtils.isEmpty(jvms)) {
        LOGGER.warn("No JVMs found to ping.");
        return;
    }

    for (final Jvm jvm : jvms) {
        if (stateNotInMemory(jvm) || isValidState(jvm) && isFutureNilOrDone(jvm) && isStale(jvm)) {
            LOGGER.debug("Pinging JVM {} ...", jvm.getJvmName());
            PING_FUTURE_MAP.put(jvm.getId(), jvmStateResolverWorker.pingAndUpdateJvmState(jvm, this));
            LOGGER.debug("Pinged JVM {}", jvm.getJvmName());
        }
    }
}
 
开发者ID:cerner,项目名称:jwala,代码行数:18,代码来源:JvmStateServiceImpl.java

示例5: getTemplatesPatterns

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private List<PatternModel> getTemplatesPatterns(Resource resource, String patternsPath, String patternId,
                                                List<String> templateNames) throws IOException {
    List<PatternModel> templatesPatterns = Lists.newArrayList();
    final Resource folderResource = resource.getParent();
    final List<String> jsonDataFiles = retrieveJsonDataFilesInFolder(folderResource, StringUtils.substringBefore(resource.getName(), PatternLabConstants.HTML_EXT));
    for (String templateName : templateNames) {
        final List<String> templateDedicatedDataFiles = getTemplateDedicatedFiles(templateName, jsonDataFiles, templateNames);
        if (CollectionUtils.isEmpty(templateDedicatedDataFiles)) {
            templatesPatterns.add(new PatternModel(resource, patternsPath, patternId, StringUtils.EMPTY, templateName, this.resourceResolver));
        } else {
            for (String jsonDataFileName : templateDedicatedDataFiles) {
                templatesPatterns.add(new PatternModel(resource, patternsPath, patternId, jsonDataFileName, templateName, this.resourceResolver));
            }
        }
    }
    return templatesPatterns;
}
 
开发者ID:deepthinkit,项目名称:patternlab-for-sling,代码行数:18,代码来源:PatternPatternCategoryFactoryImpl.java

示例6: combineData

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private List<List<ImmutablePair<Gene, List<Sequence>>>> combineData(
        final Map<Gene, List<List<Sequence>>> data,
        final Comparator<Gene> comparator) {
    List<List<ImmutablePair<Gene, List<Sequence>>>> source =
            data.entrySet().stream().sorted((e1, e2) -> comparator.compare(e1.getKey(), e2.getKey()))
                    .map(e -> e.getValue().stream().map(s -> new ImmutablePair<>(e.getKey(), s))
                            .collect(Collectors.toList())).collect(Collectors.toList());
    if (CollectionUtils.isEmpty(source)) {
        return Collections.emptyList();
    }
    List<List<ImmutablePair<Gene, List<Sequence>>>> start = new ArrayList<>();
    for (ImmutablePair<Gene, List<Sequence>> p : source.remove(0)) {
        List<ImmutablePair<Gene, List<Sequence>>> ll = new ArrayList<>();
        ll.add(p);
        start.add(ll);
    }
    return recursiveCombine(start, source);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:19,代码来源:ProteinSequenceManager.java

示例7: loadVcfFiles

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
@Transactional(propagation = Propagation.REQUIRED)
public List<VcfFile> loadVcfFiles(List<Long> ids) {
    if (CollectionUtils.isEmpty(ids)) {
        return Collections.emptyList();
    }

    List<VcfFile> files = vcfFileDao.loadVcfFiles(ids);
    if (files.size() != ids.size()) {
        List<Long> notFound = new ArrayList<>(ids);
        notFound.removeAll(files.stream().map(BaseEntity::getId).collect(Collectors.toList()));
        Assert.isTrue(notFound.isEmpty(), MessageHelper.getMessage(MessagesConstants.ERROR_FILE_NOT_FOUND,
                                                                   notFound.stream()
                                                                       .map(i -> i.toString())
                                                                       .collect(Collectors.joining(", "))));
    }

    return files;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:19,代码来源:VcfFileManager.java

示例8: withPort

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
public ComponentBuilder withPort(Port port) {
    if(CollectionUtils.isEmpty(this.ports)) {
        this.ports = new ArrayList<>();
    }
    this.ports.add(port);
    return this;
}
 
开发者ID:BaiduQA-SETI,项目名称:docker-image-builder,代码行数:8,代码来源:ComponentBuilder.java

示例9: assertNotBlank

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
/**
 * 断言集合不为空或null,否则抛RuntimeException
 * 
 * @param collection 断言集合
 * @param errMsg 异常描述
 */
@SuppressWarnings("rawtypes")
public static void assertNotBlank(Collection collection, String errMsg) {

    if (CollectionUtils.isEmpty(collection)) {
        throw new RuntimeException(errMsg);
    }
}
 
开发者ID:huhuics,项目名称:tauren,代码行数:14,代码来源:AssertUtil.java

示例10: swap

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private static Map< Serializable, List< ParentChildrenRecursion > > swap ( List< ? extends ParentChildrenRecursion > list ) {
	if ( CollectionUtils.isEmpty( list ) ) {
		return Collections.emptyMap();
	}
	Map< Serializable, List< ParentChildrenRecursion > > content = new HashMap<>();
	list.forEach( element -> {
		List resources = content.get( element.getParentId() );
		if ( CollectionUtils.isEmpty( resources ) ) {
			resources = new ArrayList<>();
		}
		resources.add( element );
		content.put( element.getParentId() , resources );
	} );
	return content;
}
 
开发者ID:yujunhao8831,项目名称:spring-boot-start-current,代码行数:16,代码来源:RecursionUtils.java

示例11: decryptAdapterClientSecrets

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private Set<AttributeAdapterConnection> decryptAdapterClientSecrets(
        final Set<AttributeAdapterConnection> adapters) {
    if (CollectionUtils.isEmpty(adapters)) {
        return Collections.emptySet();
    }
    adapters.forEach(adapter -> adapter.setUaaClientSecret(this.encryptor.decrypt(adapter.getUaaClientSecret())));
    return adapters;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:9,代码来源:AttributeConnectorServiceImpl.java

示例12: getPortByMacAddress

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
private Port getPortByMacAddress(String region, String macAddress) {
    getOs().useRegion(region);
    List<? extends Port> portList = getOs().networking().port().list(PortListOptions.create().macAddress(macAddress));
    if (CollectionUtils.isEmpty(portList)) {
        log.info(String.format("No ports found with mac: %s in region: %s", macAddress, region));
    }
    return portList.isEmpty() ? null : portList.get(0);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:9,代码来源:Openstack4JNeutron.java

示例13: groupVariations

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
/**
 * Groups variations from specified {@link List} of {@link VcfFile}s by specified field
 * @param files a {@link List} of {@link FeatureFile}, which indexes to search
 * @param query a query to search in index
 * @param groupBy a field to perform grouping
 * @return a {@link List} of {@link Group}s, mapping field value to number of variations, having this value
 * @throws IOException if something goes wrong with the file system
 */
public List<Group> groupVariations(List<VcfFile> files, Query query, String groupBy) throws IOException {
    List<Group> res = new ArrayList<>();

    if (CollectionUtils.isEmpty(files)) {
        return Collections.emptyList();
    }

    SimpleFSDirectory[] indexes = fileManager.getIndexesForFiles(files);

    try (MultiReader reader = openMultiReader(indexes)) {
        if (reader.numDocs() == 0) {
            return Collections.emptyList();
        }

        IndexSearcher searcher = new IndexSearcher(reader);
        AbstractGroupFacetCollector groupedFacetCollector =
            TermGroupFacetCollector.createTermGroupFacetCollector(FeatureIndexFields.UID.fieldName,
                                                  getGroupByField(files, groupBy), false, null, GROUP_INITIAL_SIZE);
        searcher.search(query, groupedFacetCollector); // Computing the grouped facet counts
        TermGroupFacetCollector.GroupedFacetResult groupedResult = groupedFacetCollector.mergeSegmentResults(
            reader.numDocs(), 1, false);
        List<AbstractGroupFacetCollector.FacetEntry> facetEntries = groupedResult.getFacetEntries(0,
                                                                                                  reader.numDocs());
        for (AbstractGroupFacetCollector.FacetEntry facetEntry : facetEntries) {
            res.add(new Group(facetEntry.getValue().utf8ToString(), facetEntry.getCount()));
        }
    } finally {
        for (SimpleFSDirectory index : indexes) {
            IOUtils.closeQuietly(index);
        }
    }

    return res;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:43,代码来源:FeatureIndexDao.java

示例14: withFile

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
public ComponentBuilder withFile(UploadFile file) {
    if(CollectionUtils.isEmpty(this.files)) {
        this.files = new ArrayList<>();
    }
    this.files.add(file);
    return this;
}
 
开发者ID:BaiduQA-SETI,项目名称:docker-image-builder,代码行数:8,代码来源:ComponentBuilder.java

示例15: getAllFiles

import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
public List<UploadFile> getAllFiles(){
    List<UploadFile> files = new ArrayList<>();
    if(!CollectionUtils.isEmpty(this.getComponents())){
        files =  this.getComponents().stream()
                .map(component -> component.getFiles())
                .flatMap(list -> list.stream()).collect(Collectors.toList());
    }
    //add image ports
    if(!CollectionUtils.isEmpty(this.getPorts())){
        files.addAll(this.getFiles());
    }
    return files;
}
 
开发者ID:BaiduQA-SETI,项目名称:docker-image-builder,代码行数:14,代码来源:Image.java


注:本文中的org.apache.commons.collections4.CollectionUtils.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。