use of com.google.common.collect.testing.features.CollectionSize in project guava by google.
the class MapTestSuiteBuilder method computeCommonDerivedCollectionFeatures.
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;
}
use of com.google.common.collect.testing.features.CollectionSize in project guava by hceylan.
the class BiMapTestSuiteBuilder method computeCommonDerivedCollectionFeatures.
private static Set<Feature<?>> computeCommonDerivedCollectionFeatures(Set<Feature<?>> mapFeatures) {
Set<Feature<?>> derivedFeatures = new HashSet<Feature<?>>();
if (mapFeatures.contains(MapFeature.SUPPORTS_REMOVE)) {
derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE);
derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE_ALL);
derivedFeatures.add(CollectionFeature.SUPPORTS_RETAIN_ALL);
}
if (mapFeatures.contains(MapFeature.SUPPORTS_CLEAR)) {
derivedFeatures.add(CollectionFeature.SUPPORTS_CLEAR);
}
if (mapFeatures.contains(MapFeature.REJECTS_DUPLICATES_AT_CREATION)) {
derivedFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION);
}
// add the intersection of CollectionSize.values() and mapFeatures
for (CollectionSize size : CollectionSize.values()) {
if (mapFeatures.contains(size)) {
derivedFeatures.add(size);
}
}
return derivedFeatures;
}
use of com.google.common.collect.testing.features.CollectionSize in project guava by hceylan.
the class MapTestSuiteBuilder method computeCommonDerivedCollectionFeatures.
private static Set<Feature<?>> computeCommonDerivedCollectionFeatures(Set<Feature<?>> mapFeatures) {
Set<Feature<?>> derivedFeatures = new HashSet<Feature<?>>();
if (mapFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
derivedFeatures.add(CollectionFeature.SERIALIZABLE);
}
if (mapFeatures.contains(MapFeature.SUPPORTS_REMOVE)) {
derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE);
derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE_ALL);
derivedFeatures.add(CollectionFeature.SUPPORTS_RETAIN_ALL);
}
if (mapFeatures.contains(MapFeature.SUPPORTS_CLEAR)) {
derivedFeatures.add(CollectionFeature.SUPPORTS_CLEAR);
}
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 CollectionSize.values() and mapFeatures
for (CollectionSize size : CollectionSize.values()) {
if (mapFeatures.contains(size)) {
derivedFeatures.add(size);
}
}
return derivedFeatures;
}
Aggregations