Search in sources :

Example 1 with Sets.newLinkedHashSet

use of com.google.common.collect.Sets.newLinkedHashSet in project guava by google.

the class SetsTest method testsForFilterNoNulls.

// suite
@GwtIncompatible
private static Test testsForFilterNoNulls() {
    TestSuite suite = new TestSuite();
    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        public Set<String> create(String[] elements) {
            Set<String> unfiltered = Sets.newLinkedHashSet();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.copyOf(elements));
            unfiltered.add("zzz");
            return Sets.filter(unfiltered, Collections2Test.LENGTH_1);
        }
    }).named("Sets.filter, no nulls").withFeatures(CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(NavigableSetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        public NavigableSet<String> create(String[] elements) {
            NavigableSet<String> unfiltered = Sets.newTreeSet();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.copyOf(elements));
            unfiltered.add("zzz");
            return Sets.filter(unfiltered, Collections2Test.LENGTH_1);
        }

        @Override
        public List<String> order(List<String> insertionOrder) {
            return Ordering.natural().sortedCopy(insertionOrder);
        }
    }).named("Sets.filter[NavigableSet]").withFeatures(CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    return suite;
}
Also used : TestStringSetGenerator(com.google.common.collect.testing.TestStringSetGenerator) Sets.unmodifiableNavigableSet(com.google.common.collect.Sets.unmodifiableNavigableSet) NavigableSet(java.util.NavigableSet) SortedSet(java.util.SortedSet) Sets.unmodifiableNavigableSet(com.google.common.collect.Sets.unmodifiableNavigableSet) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) Sets.newEnumSet(com.google.common.collect.Sets.newEnumSet) EnumSet(java.util.EnumSet) Set(java.util.Set) NavigableSet(java.util.NavigableSet) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) Sets.powerSet(com.google.common.collect.Sets.powerSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Collections.emptySet(java.util.Collections.emptySet) Sets.newLinkedHashSet(com.google.common.collect.Sets.newLinkedHashSet) SafeTreeSet(com.google.common.collect.testing.SafeTreeSet) TestSuite(junit.framework.TestSuite) List(java.util.List) ArrayList(java.util.ArrayList) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Aggregations

GwtIncompatible (com.google.common.annotations.GwtIncompatible)1 Sets.newEnumSet (com.google.common.collect.Sets.newEnumSet)1 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)1 Sets.newLinkedHashSet (com.google.common.collect.Sets.newLinkedHashSet)1 Sets.powerSet (com.google.common.collect.Sets.powerSet)1 Sets.unmodifiableNavigableSet (com.google.common.collect.Sets.unmodifiableNavigableSet)1 SafeTreeSet (com.google.common.collect.testing.SafeTreeSet)1 TestStringSetGenerator (com.google.common.collect.testing.TestStringSetGenerator)1 ArrayList (java.util.ArrayList)1 Collections.emptySet (java.util.Collections.emptySet)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 NavigableSet (java.util.NavigableSet)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)1 TestSuite (junit.framework.TestSuite)1