Java 类org.apache.commons.collections.SetUtils 实例源码

项目:gerbil    文件:SimpleClassNode.java   
@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;
}
项目:projectforge-webapp    文件:GroupDOConverter.java   
/**
 * 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;
}
项目:registry    文件:SchemaBranchLifeCycleTest.java   
@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));
}
项目:java-util-examples    文件:InitializeSet.java   
@Test
public void create_new_set_apache () {

    @SuppressWarnings("unchecked")
    Set<String> newSet = SetUtils.EMPTY_SET;

    assertNotNull(newSet);
}
项目:java-util-examples    文件:ReturnEmptySet.java   
@Test
public void return_empty_set_apache_commons () {

    @SuppressWarnings("unchecked")
    Set<String> emptySet = SetUtils.EMPTY_SET;

    assertTrue(emptySet.isEmpty());
}
项目:java-util-examples    文件:ReturnEmptySet.java   
/**
 * 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;
    }

    //...
}
项目:levelup-java-examples    文件:InitializeSet.java   
@Test
public void create_new_set_apache () {

    @SuppressWarnings("unchecked")
    Set<String> newSet = SetUtils.EMPTY_SET;

    assertNotNull(newSet);
}
项目:levelup-java-examples    文件:ReturnEmptySet.java   
@Test
public void return_empty_set_apache_commons () {

    @SuppressWarnings("unchecked")
    Set<String> emptySet = SetUtils.EMPTY_SET;

    assertTrue(emptySet.isEmpty());
}
项目:levelup-java-examples    文件:ReturnEmptySet.java   
/**
 * 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;
    }

    //...
}
项目:AppStash    文件:NavigationProviderImpl.java   
@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);
}
项目:java-util-examples    文件:ReturnEmptySortedSet.java   
@Test
public void return_empty_sorted_set_apache_commons () {

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

    assertTrue(emptySortedSet.isEmpty());

}
项目:levelup-java-examples    文件:ReturnEmptySortedSet.java   
@Test
public void return_empty_sorted_set_apache_commons () {

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

    assertTrue(emptySortedSet.isEmpty());

}