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


Java SetUtils类代码示例

本文整理汇总了Java中org.apache.commons.collections.SetUtils的典型用法代码示例。如果您正苦于以下问题:Java SetUtils类的具体用法?Java SetUtils怎么用?Java SetUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: equals

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (!(obj instanceof SimpleClassNode))
        return false;
    SimpleClassNode other = (SimpleClassNode) obj;
    if (uris == null) {
        if (other.uris != null)
            return false;
    } else if (!SetUtils.isEqualSet(uris, other.uris))
        return false;
    return true;
}
 
开发者ID:dice-group,项目名称:gerbil,代码行数:17,代码来源:SimpleClassNode.java

示例2: copyGroupFields

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
/**
 * Copies the fields.
 * @param src
 * @param dest
 * @return true if any modification is detected, otherwise false.
 */
public static boolean copyGroupFields(final LdapGroup src, final LdapGroup dest)
{
  boolean modified;
  final List<String> properties = new LinkedList<String>();
  ListHelper.addAll(properties, "description", "organization");
  if (LdapUserDao.isPosixAccountsConfigured() == true && isPosixAccountValuesEmpty(src) == false) {
    ListHelper.addAll(properties, "gidNumber");
  }
  modified = BeanHelper.copyProperties(src, dest, true, properties.toArray(new String[0]));
  // Checks if the sets aren't equal:
  if (SetUtils.isEqualSet(src.getMembers(), dest.getMembers()) == false) {
    if (LdapGroupDao.hasMembers(src) == true || LdapGroupDao.hasMembers(dest) == true) {
      // If both, src and dest have no members, then do nothing, otherwise:
      modified = true;
      dest.clearMembers();
      dest.addAllMembers(src.getMembers());
    }
  }
  return modified;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:27,代码来源:GroupDOConverter.java

示例3: getAllBranches

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@Test
public void getAllBranches() throws IOException, SchemaBranchNotFoundException, InvalidSchemaException, SchemaNotFoundException, IncompatibleSchemaException, SchemaBranchAlreadyExistsException {
    SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);

    SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
    SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
    SchemaIdVersion masterSchemaIdVersion2 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device-incompat.avsc");
    SchemaBranch schemaBranch2 = addSchemaBranch("BRANCH2", schemaMetadata, masterSchemaIdVersion2.getSchemaVersionId());

    Set<String> actualSchemaBranches = schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).stream().map(branch -> branch.getName()).collect(Collectors.toSet());
    Set<String> expectedSchemaBranches = new HashSet<>(Lists.newArrayList("MASTER", schemaBranch1.getName(), schemaBranch2.getName()));

    Assert.assertTrue(SetUtils.isEqualSet(actualSchemaBranches, expectedSchemaBranches));
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:15,代码来源:SchemaBranchLifeCycleTest.java

示例4: create_new_set_apache

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@Test
public void create_new_set_apache () {

	@SuppressWarnings("unchecked")
	Set<String> newSet = SetUtils.EMPTY_SET;
	
	assertNotNull(newSet);
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:9,代码来源:InitializeSet.java

示例5: return_empty_set_apache_commons

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@Test
public void return_empty_set_apache_commons () {
	
	@SuppressWarnings("unchecked")
	Set<String> emptySet = SetUtils.EMPTY_SET;
	
	assertTrue(emptySet.isEmpty());
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:9,代码来源:ReturnEmptySet.java

示例6: return_empty_set_apache_commons_exception

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
/**
 * Used for post example
 */
@SuppressWarnings({ "unused", "unchecked" })
private void return_empty_set_apache_commons_exception () {
	DomainObject domain = null; // dao populate domain

	Set<String> strings;
	if (domain != null && !CollectionUtils.isEmpty(domain.getStrings())) {
		strings = domain.getStrings();
	} else {
		strings = SetUtils.EMPTY_SET;
	}

	//...
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:17,代码来源:ReturnEmptySet.java

示例7: getAnnotatedWicketPage

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked") // apache commons collection api does not support generics
public static Set<Class<? extends Page>> getAnnotatedWicketPage(String packageScanPath, Class<? extends Annotation> annotationClazz) {
    Reflections reflections = new Reflections(packageScanPath);
    return SetUtils.predicatedSet(reflections.getTypesAnnotatedWith(annotationClazz), PAGE_PREDICATE);
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:6,代码来源:NavigationProviderImpl.java

示例8: return_empty_sorted_set_apache_commons

import org.apache.commons.collections.SetUtils; //导入依赖的package包/类
@Test
public void return_empty_sorted_set_apache_commons () {

	@SuppressWarnings("unchecked")
	Set<String> emptySortedSet = SetUtils.EMPTY_SORTED_SET;
	
	assertTrue(emptySortedSet.isEmpty());

}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:10,代码来源:ReturnEmptySortedSet.java


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