Lines Matching refs:Sets
20 import static com.google.common.collect.Sets.newEnumSet;
21 import static com.google.common.collect.Sets.newHashSet;
22 import static com.google.common.collect.Sets.powerSet;
80 * Unit test for {@code Sets}.
121 ? Sets.newHashSet(
123 : Sets.newHashSet(elements);
126 ? Sets.newHashSet(
128 : Sets.<String>newHashSet();
129 return Sets.union(set1, set2);
132 .named("Sets.union")
138 Set<String> set1 = Sets.newHashSet(elements);
140 Set<String> set2 = Sets.newHashSet(elements);
142 return Sets.intersection(set1, set2);
145 .named("Sets.intersection")
151 Set<String> set1 = Sets.newHashSet(elements);
153 Set<String> set2 = Sets.newHashSet(samples().e3);
154 return Sets.difference(set1, set2);
157 .named("Sets.difference")
166 return Sets.immutableEnumSet(elements[0], otherElements);
169 .named("Sets.immutableEnumSet")
185 Set<String> unfiltered = Sets.newLinkedHashSet();
189 return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
192 .named("Sets.filter")
206 Set<String> unfiltered = Sets.newLinkedHashSet();
210 return Sets.filter(unfiltered, Collections2Test.LENGTH_1);
213 .named("Sets.filter, no nulls")
227 Set<String> unfiltered = Sets.newLinkedHashSet();
232 return Sets.filter(
233 Sets.filter(unfiltered, Collections2Test.LENGTH_1),
237 .named("Sets.filter, filtered input")
250 Set<SomeEnum> units = Sets.immutableEnumSet(SomeEnum.D, SomeEnum.B);
265 Set<SomeEnum> units = Sets.immutableEnumSet(SomeEnum.D, SomeEnum.B);
275 = Sets.immutableEnumSet(MinimalIterable.<SomeEnum>of());
279 = Sets.immutableEnumSet(MinimalIterable.of(SomeEnum.B));
283 = Sets.immutableEnumSet(MinimalIterable.of(SomeEnum.D, SomeEnum.B));
291 Sets.immutableEnumSet(SomeEnum.A, SomeEnum.B);
354 HashSet<Integer> set = Sets.newHashSet();
359 HashSet<Integer> set = Sets.newHashSet(0, 1, 1);
364 HashSet<Integer> set = Sets.newHashSet(SOME_COLLECTION);
369 HashSet<Integer> set = Sets.newHashSet(SOME_ITERABLE);
374 HashSet<Integer> set = Sets.newHashSetWithExpectedSize(0);
379 HashSet<Integer> set = Sets.newHashSetWithExpectedSize(1000);
384 HashSet<Integer> set = Sets.newHashSet(SOME_COLLECTION.iterator());
389 LinkedHashSet<Integer> set = Sets.newLinkedHashSet();
394 LinkedHashSet<Integer> set = Sets.newLinkedHashSet(LONGER_LIST);
399 LinkedHashSet<Integer> set = Sets.newLinkedHashSet(new Iterable<Integer>()
410 LinkedHashSet<Integer> set = Sets.newLinkedHashSetWithExpectedSize(0);
415 LinkedHashSet<Integer> set = Sets.newLinkedHashSetWithExpectedSize(1000);
420 TreeSet<Integer> set = Sets.newTreeSet();
425 TreeSet<Derived> set = Sets.newTreeSet();
433 TreeSet<LegacyComparable> set = Sets.newTreeSet();
441 TreeSet<Integer> set = Sets.newTreeSet(SOME_COLLECTION);
446 TreeSet<Integer> set = Sets.newTreeSet(SOME_ITERABLE);
453 TreeSet<Derived> set = Sets.newTreeSet(iterable);
461 TreeSet<LegacyComparable> set = Sets.newTreeSet(iterable);
467 TreeSet<Integer> set = Sets.newTreeSet(SOME_COMPARATOR);
472 Set<Integer> set = Sets.newIdentityHashSet();
484 EnumSet<SomeEnum> otherUnits = Sets.complementOf(units);
490 EnumSet<SomeEnum> otherUnits = Sets.complementOf(units, SomeEnum.class);
495 Set<SomeEnum> units = Sets.newHashSet(SomeEnum.B, SomeEnum.D);
496 EnumSet<SomeEnum> otherUnits = Sets.complementOf(units);
501 Set<SomeEnum> units = Sets.newHashSet(SomeEnum.B, SomeEnum.D);
502 EnumSet<SomeEnum> otherUnits = Sets.complementOf(units, SomeEnum.class);
508 EnumSet<SomeEnum> allUnits = Sets.complementOf(noUnits, SomeEnum.class);
513 Set<SomeEnum> allUnits = Sets.newHashSet(SomeEnum.values());
514 EnumSet<SomeEnum> noUnits = Sets.complementOf(allUnits, SomeEnum.class);
520 EnumSet<SomeEnum> allUnits = Sets.complementOf(noUnits);
527 Sets.complementOf(set);
541 tester.testAllPublicStaticMethods(Sets.class);
545 Set<Integer> set = Sets.newSetFromMap(new HashMap<Integer, Boolean>());
553 Sets.newSetFromMap(new LinkedHashMap<Integer, Boolean>());
563 Sets.newSetFromMap(map);
576 ASSERT.that(Sets.cartesianProduct()).hasContentsAnyOrder(list());
585 ASSERT.that(Sets.cartesianProduct(set(1, 2))).hasContentsAnyOrder(list(1), list(2));
591 assertEmpty(Sets.cartesianProduct(mt, mt));
597 assertEmpty(Sets.cartesianProduct(mt, set(1)));
603 assertEmpty(Sets.cartesianProduct(set(1), mt));
614 ASSERT.that(Sets.cartesianProduct(set(1), set(2))).hasContentsAnyOrder(list(1, 2));
619 ASSERT.that(Sets.cartesianProduct(set(1), set(2, 3))).hasContentsAnyOrder(
625 ASSERT.that(Sets.cartesianProduct(set(1, 2), set(3, 4))).hasContentsAnyOrder(
631 ASSERT.that(Sets.cartesianProduct(set(0, 1), set(0, 1), set(0, 1))).hasContentsAnyOrder(
638 Set<List<Integer>> actual = Sets.cartesianProduct(set(1, 2), set(3, 4));
656 ASSERT.that(Sets.<Object>cartesianProduct(x, y)).hasContentsAnyOrder(exp1, exp2, exp3, exp4);
663 Set<List<Integer>> productSet = Sets.cartesianProduct(set, set, set, set, set);
672 Set<List<Integer>> degenerate = Sets.cartesianProduct();
675 checkHashCode(Sets.cartesianProduct(set(1, 2)));
678 checkHashCode(Sets.cartesianProduct(set(1, 2, num)));
681 checkHashCode(Sets.cartesianProduct(mt, mt));
682 checkHashCode(Sets.cartesianProduct(mt, set(num)));
683 checkHashCode(Sets.cartesianProduct(set(num), mt));
684 checkHashCode(Sets.cartesianProduct(set(num), set(1)));
685 checkHashCode(Sets.cartesianProduct(set(1), set(2, num)));
686 checkHashCode(Sets.cartesianProduct(set(1, num), set(2, num - 1)));
687 checkHashCode(Sets.cartesianProduct(
691 checkHashCode(Sets.cartesianProduct(
903 assertEquals(Sets.newHashSet(set).hashCode(), set.hashCode());
1001 Set<String> unfiltered = Sets.newHashSet();
1002 Set<String> filtered = Sets.filter(
1003 Sets.filter(unfiltered, Collections2Test.LENGTH_1),
1030 SortedSet<Long> sorted = Sets.newTreeSet();
1034 SortedSet<Long> filteredEven = Sets.filter(sorted, new Predicate<Long>() {
1057 static SortedSet<Long> filteredEmpty = Sets.filter(new TreeSet<Long>(), Predicates.alwaysTrue());
1076 static SortedSet<Long> sorted = Sets.newTreeSet();
1082 static SortedSet<Long> filterAllElements = Sets.filter(sorted, Predicates.alwaysFalse());