本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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);
}
示例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());
}
示例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;
}
//...
}
示例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);
}
示例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());
}