本文整理汇总了Java中com.google.common.collect.testing.features.CollectionFeature.values方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionFeature.values方法的具体用法?Java CollectionFeature.values怎么用?Java CollectionFeature.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.testing.features.CollectionFeature
的用法示例。
在下文中一共展示了CollectionFeature.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeCommonDerivedCollectionFeatures
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
public static Set<Feature<?>> computeCommonDerivedCollectionFeatures(
Set<Feature<?>> mapFeatures) {
mapFeatures = new HashSet<Feature<?>>(mapFeatures);
Set<Feature<?>> derivedFeatures = new HashSet<Feature<?>>();
mapFeatures.remove(CollectionFeature.SERIALIZABLE);
if (mapFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
derivedFeatures.add(CollectionFeature.SERIALIZABLE);
}
if (mapFeatures.contains(MapFeature.SUPPORTS_REMOVE)) {
derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE);
}
if (mapFeatures.contains(MapFeature.REJECTS_DUPLICATES_AT_CREATION)) {
derivedFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION);
}
if (mapFeatures.contains(MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION)) {
derivedFeatures.add(CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION);
}
// add the intersection of CollectionFeature.values() and mapFeatures
for (CollectionFeature feature : CollectionFeature.values()) {
if (mapFeatures.contains(feature)) {
derivedFeatures.add(feature);
}
}
// add the intersection of CollectionSize.values() and mapFeatures
for (CollectionSize size : CollectionSize.values()) {
if (mapFeatures.contains(size)) {
derivedFeatures.add(size);
}
}
return derivedFeatures;
}