Search in sources :

Example 1 with CollectionSize

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;
}
Also used : CollectionSize(com.google.common.collect.testing.features.CollectionSize) CollectionFeature(com.google.common.collect.testing.features.CollectionFeature) CollectionFeature(com.google.common.collect.testing.features.CollectionFeature) Feature(com.google.common.collect.testing.features.Feature) MapFeature(com.google.common.collect.testing.features.MapFeature) HashSet(java.util.HashSet)

Example 2 with CollectionSize

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;
}
Also used : CollectionSize(com.google.common.collect.testing.features.CollectionSize) CollectionFeature(com.google.common.collect.testing.features.CollectionFeature) Feature(com.google.common.collect.testing.features.Feature) MapFeature(com.google.common.collect.testing.features.MapFeature) HashSet(java.util.HashSet)

Example 3 with CollectionSize

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;
}
Also used : CollectionSize(com.google.common.collect.testing.features.CollectionSize) CollectionFeature(com.google.common.collect.testing.features.CollectionFeature) Feature(com.google.common.collect.testing.features.Feature) MapFeature(com.google.common.collect.testing.features.MapFeature) HashSet(java.util.HashSet)

Aggregations

CollectionFeature (com.google.common.collect.testing.features.CollectionFeature)3 CollectionSize (com.google.common.collect.testing.features.CollectionSize)3 Feature (com.google.common.collect.testing.features.Feature)3 MapFeature (com.google.common.collect.testing.features.MapFeature)3 HashSet (java.util.HashSet)3