org.apache.commons.collections4.CollectionUtils.sizeIsEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(229)

本文整理了Java中org.apache.commons.collections4.CollectionUtils.sizeIsEmpty()方法的一些代码示例,展示了CollectionUtils.sizeIsEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CollectionUtils.sizeIsEmpty()方法的具体详情如下:
包路径:org.apache.commons.collections4.CollectionUtils
类名称:CollectionUtils
方法名:sizeIsEmpty

CollectionUtils.sizeIsEmpty介绍

[英]Checks if the specified collection/array/iterator is empty.

This method can handles objects as follows

  • Collection - via collection isEmpty
  • Map - via map isEmpty
  • Array - using array size
  • Iterator - via hasNext
  • Enumeration - via hasMoreElements

Note: This method is named to avoid clashing with #isEmpty(Collection).
[中]检查指定的集合/数组/迭代器是否为空。
此方法可以按如下方式处理对象
*集合-通过集合isEmpty
*地图-通过地图是空的
*数组-使用数组大小
*迭代器-通过hasNext
*枚举-通过hasMoreElements
注意:命名此方法是为了避免与#isEmpty(集合)冲突。

代码示例

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkDelete
@PreAuthorize("hasAuthority('PERM_SYSTEM_MANAGE_DATASOURCE')")
public void handleBeforeLinkDelete(DataConnection dataConnection, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // 전체 공개 워크스페이스가 아니고 linked 내 Entity 타입이 Workspace 인 경우
 if(BooleanUtils.isNotTrue(dataConnection.getPublished()) &&
   !CollectionUtils.sizeIsEmpty(linked) &&
   CollectionUtils.get(linked, 0) instanceof Workspace) {
  dataConnection.setLinkedWorkspaces(dataConnection.getWorkspaces().size());
  LOGGER.debug("DELETED: Set linked workspace in datasource({}) : {}", dataConnection.getId(), dataConnection.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkDelete
@PreAuthorize("hasAuthority('PERM_SYSTEM_MANAGE_DATASOURCE')")
public void handleBeforeLinkDelete(DataSource dataSource, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // 전체 공개 워크스페이스가 아니고 linked 내 Entity 타입이 Workspace 인 경우
 if (BooleanUtils.isNotTrue(dataSource.getPublished()) &&
   !CollectionUtils.sizeIsEmpty(linked) &&
   CollectionUtils.get(linked, 0) instanceof Workspace) {
  dataSource.setLinkedWorkspaces(dataSource.getWorkspaces().size());
  LOGGER.debug("DELETED: Set linked workspace in datasource({}) : {}", dataSource.getId(), dataSource.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkDelete
//  @PreAuthorize("hasAnyAuthority('PERM_SYSTEM_WRITE_USER') " +
//      "or hasPermission(#roleSet, 'PERM_WORKSPACE_WRITE_MEMBER')")
 public void handleBeforeLinkDelete(RoleSet roleSet, Object linked) {

  // 연결된 워크스페이스 개수 처리,
  // 전체 공개 워크스페이스가 아니고 linked 내 Entity 타입이 Workspace 인 경우
  if (roleSet.getScope() == RoleSet.RoleSetScope.PUBLIC &&
    !CollectionUtils.sizeIsEmpty(linked) &&
    CollectionUtils.get(linked, 0) instanceof Workspace) {
   roleSet.setLinkedWorkspaces(roleSet.getWorkspaces().size());
   LOGGER.debug("DELETED: Set linked workspace in roleset({}) : {}", roleSet.getId(), roleSet.getLinkedWorkspaces());
  }

 }

代码示例来源:origin: net.sourceforge.ondex.modules/rdf-export-2

if ( sizeIsEmpty ( rel.getAttributes () ) && sizeIsEmpty ( rel.getEvidence () ) && sizeIsEmpty ( rel.getTags () ) )

相关文章