@Test
 public void properSubsetEqual() {
   MutableSet<String> setA = UnifiedSet.newSetWith("Bertha", null, "Myra");
   MutableSet<String> setB = UnifiedSet.newSetWith("Myra", "Bertha", null);
   Assert.assertFalse(Sets.isProperSubsetOf(setA, setB));
   Assert.assertFalse(Sets.isProperSubsetOf(setB, setA));
 }
 @Test
 public void properSubsetNotEmpty() {
   MutableSet<String> singletonSet = UnifiedSet.newSetWith("Bertha");
   MutableSet<String> doubletonSet = UnifiedSet.newSetWith("Bertha", "Myra");
   Assert.assertTrue(Sets.isProperSubsetOf(singletonSet, doubletonSet));
   Assert.assertFalse(Sets.isProperSubsetOf(doubletonSet, singletonSet));
 }
 @Test
 public void flatCollect() {
   Function<Integer, MutableSet<String>> function =
       object -> UnifiedSet.newSetWith(object.toString());
   Verify.assertListsEqual(
       FastList.newListWith("1"), SingletonListTest.newWith(1).flatCollect(function));
   Verify.assertSetsEqual(
       UnifiedSet.newSetWith("1"),
       SingletonListTest.newWith(1).flatCollect(function, UnifiedSet.<String>newSet()));
 }
 @Test
 public void fixedSize() {
   FixedSizeSetFactory setFactory = Sets.fixedSize;
   Assert.assertEquals(UnifiedSet.newSet(), setFactory.of());
   Verify.assertInstanceOf(FixedSizeSet.class, setFactory.of());
   Assert.assertEquals(UnifiedSet.newSetWith(1), setFactory.of(1));
   Verify.assertInstanceOf(FixedSizeSet.class, setFactory.of(1));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2), setFactory.of(1, 2));
   Verify.assertInstanceOf(FixedSizeSet.class, setFactory.of(1, 2));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2, 3), setFactory.of(1, 2, 3));
   Verify.assertInstanceOf(FixedSizeSet.class, setFactory.of(1, 2, 3));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2, 3, 4), setFactory.of(1, 2, 3, 4));
   Verify.assertInstanceOf(FixedSizeSet.class, setFactory.of(1, 2, 3, 4));
 }
 @Test
 public void cartesianProduct() {
   MutableSet<Integer> set1 = UnifiedSet.newSetWith(1, 2);
   MutableSet<Integer> set2 = UnifiedSet.newSetWith(2, 3, 4);
   MutableBag<Pair<Integer, Integer>> expectedCartesianProduct =
       Bags.mutable.of(
           Tuples.pair(1, 2),
           Tuples.pair(2, 2),
           Tuples.pair(1, 3),
           Tuples.pair(2, 3),
           Tuples.pair(1, 4),
           Tuples.pair(2, 4));
   Assert.assertEquals(expectedCartesianProduct, Sets.cartesianProduct(set1, set2).toBag());
 }
 @Test
 public void properSubsetEmpty() {
   MutableSet<String> emptySet = mSet();
   MutableSet<String> singletonSet = UnifiedSet.newSetWith("Bertha");
   Assert.assertTrue(Sets.isProperSubsetOf(emptySet, singletonSet));
   Assert.assertFalse(Sets.isProperSubsetOf(singletonSet, emptySet));
 }
 @Test
 public void intersectAllIdentical() {
   MutableSet<String> names =
       Sets.intersectAll(
           this.identicalSets.get(0), this.identicalSets.get(1), this.identicalSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith("Tom", "Dick", "Harry", null), names);
 }
 @Test
 public void intersectAllOverlapping() {
   MutableSet<String> names =
       Sets.intersectAll(
           this.overlappingSets.get(0), this.overlappingSets.get(1), this.overlappingSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith("Dick"), names);
 }
  @Test
  public void newListWithCollection() {
    Verify.assertEmpty(MultiReaderFastList.newList(Lists.fixedSize.of()));
    Verify.assertEmpty(MultiReaderFastList.newList(Sets.fixedSize.of()));
    Verify.assertEmpty(MultiReaderFastList.newList(FastList.newList()));
    Verify.assertEmpty(MultiReaderFastList.newList(FastList.newList(4)));

    MutableList<Integer> setToList =
        MultiReaderFastList.newList(UnifiedSet.newSetWith(1, 2, 3, 4, 5));
    Verify.assertNotEmpty(setToList);
    Verify.assertSize(5, setToList);
    Verify.assertContainsAll(setToList, 1, 2, 3, 4, 5);

    MutableList<Integer> arrayListToList =
        MultiReaderFastList.newList(Lists.fixedSize.of(1, 2, 3, 4, 5));
    Verify.assertNotEmpty(arrayListToList);
    Verify.assertSize(5, arrayListToList);
    Verify.assertStartsWith(arrayListToList, 1, 2, 3, 4, 5);

    MutableList<Integer> fastListToList =
        MultiReaderFastList.newList(FastList.<Integer>newList().with(1, 2, 3, 4, 5));
    Verify.assertNotEmpty(fastListToList);
    Verify.assertSize(5, fastListToList);
    Verify.assertStartsWith(fastListToList, 1, 2, 3, 4, 5);
  }
 @Test
 public void unionAllOverlapping() {
   MutableSet<String> names =
       Sets.unionAll(
           this.overlappingSets.get(0), this.overlappingSets.get(1), this.overlappingSets.get(2));
   Assert.assertEquals(
       UnifiedSet.newSetWith("Tom", "Dick", "Harry", "Larry", "Paul", null), names);
 }
 @Test
 public void unionAllUnique() {
   MutableSet<String> names =
       Sets.unionAll(this.uniqueSets.get(0), this.uniqueSets.get(1), this.uniqueSets.get(2));
   Assert.assertEquals(
       UnifiedSet.newSetWith(
           "Tom", "Dick", "Harry", "Jane", "Sarah", "Mary", "Fido", "Spike", "Spuds", null),
       names);
 }
 @Test
 public void powerSet() {
   MutableSet<Integer> set = UnifiedSet.newSetWith(1, 2, 3);
   MutableSet<MutableSet<Integer>> expectedPowerSet =
       UnifiedSet.<MutableSet<Integer>>newSetWith(
           UnifiedSet.<Integer>newSet(),
           UnifiedSet.newSetWith(1),
           UnifiedSet.newSetWith(2),
           UnifiedSet.newSetWith(3),
           UnifiedSet.newSetWith(1, 2),
           UnifiedSet.newSetWith(1, 3),
           UnifiedSet.newSetWith(2, 3),
           UnifiedSet.newSetWith(1, 2, 3));
   Assert.assertEquals(expectedPowerSet, Sets.powerSet(set));
 }
 @Test
 public void copySet() {
   Verify.assertInstanceOf(ImmutableSet.class, Sets.immutable.ofAll(Sets.fixedSize.of()));
   MutableSet<Integer> set = Sets.fixedSize.of(1);
   ImmutableSet<Integer> immutableSet = set.toImmutable();
   Verify.assertInstanceOf(ImmutableSet.class, Sets.immutable.ofAll(set));
   Verify.assertInstanceOf(
       ImmutableSet.class, Sets.immutable.ofAll(UnifiedSet.newSetWith(1, 2, 3, 4, 5)));
   Assert.assertSame(Sets.immutable.ofAll(immutableSet.castToSet()), immutableSet);
 }
 @Test
 public void differenceAllUnique() {
   MutableSet<String> names =
       Sets.differenceAll(this.uniqueSets.get(0), this.uniqueSets.get(1), this.uniqueSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith("Harry", "Tom", "Dick", null), names);
   Verify.assertSetsEqual(
       names,
       Sets.difference(
           Sets.difference(this.uniqueSets.get(0), this.uniqueSets.get(1)),
           this.uniqueSets.get(2)));
 }
 @Test
 public void differenceAllOverlapping() {
   MutableSet<String> names =
       Sets.differenceAll(
           this.overlappingSets.get(0), this.overlappingSets.get(1), this.overlappingSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith("Harry"), names);
   Verify.assertSetsEqual(
       names,
       Sets.difference(
           Sets.difference(this.overlappingSets.get(0), this.overlappingSets.get(1)),
           this.overlappingSets.get(2)));
 }
 @Test
 public void differenceAllIdentical() {
   MutableSet<String> names =
       Sets.differenceAll(
           this.identicalSets.get(0), this.identicalSets.get(1), this.identicalSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith(), names);
   Verify.assertSetsEqual(
       names,
       Sets.difference(
           Sets.difference(this.identicalSets.get(0), this.identicalSets.get(1)),
           this.identicalSets.get(2)));
 }
 @Test
 public void mutables() {
   MutableSetFactory setFactory = Sets.mutable;
   Assert.assertEquals(UnifiedSet.newSet(), setFactory.of());
   Verify.assertInstanceOf(MutableSet.class, setFactory.of());
   Assert.assertEquals(UnifiedSet.newSetWith(1), setFactory.of(1));
   Verify.assertInstanceOf(MutableSet.class, setFactory.of(1));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2), setFactory.of(1, 2));
   Verify.assertInstanceOf(MutableSet.class, setFactory.of(1, 2));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2, 3), setFactory.of(1, 2, 3));
   Verify.assertInstanceOf(MutableSet.class, setFactory.of(1, 2, 3));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2, 3, 4), setFactory.of(1, 2, 3, 4));
   Verify.assertInstanceOf(MutableSet.class, setFactory.of(1, 2, 3, 4));
   Assert.assertEquals(UnifiedSet.newSetWith(1, 2, 3, 4, 5), setFactory.of(1, 2, 3, 4, 5));
   Verify.assertInstanceOf(MutableSet.class, setFactory.of(1, 2, 3, 4, 5));
   Assert.assertEquals(
       UnifiedSet.newSetWith(1, 2, 3, 4, 5),
       setFactory.ofAll(UnifiedSet.newSetWith(1, 2, 3, 4, 5)));
   Verify.assertInstanceOf(
       MutableSet.class, setFactory.ofAll(UnifiedSet.newSetWith(1, 2, 3, 4, 5)));
 }
 @Test
 public void cartesianProduct_empty() {
   Assert.assertEquals(
       Bags.mutable.of(),
       HashBag.newBag(Sets.cartesianProduct(UnifiedSet.newSetWith(1, 2), UnifiedSet.newSet())));
 }
 private <E> TreeSet<E> newSortedSet(E... elements) {
   return new TreeSet<>(UnifiedSet.newSetWith(elements));
 }
 @Test
 public void powerSet_empty() {
   Assert.assertEquals(
       UnifiedSet.newSetWith(UnifiedSet.newSet()), Sets.powerSet(UnifiedSet.newSet()));
 }
 private <E> TreeSet<E> newReverseSortedSet(E... elements) {
   TreeSet<E> set = new TreeSet<>(Collections.reverseOrder());
   set.addAll(UnifiedSet.newSetWith(elements));
   return set;
 }
 @Test
 public void intersectAllUnique() {
   MutableSet<String> names =
       Sets.intersectAll(this.uniqueSets.get(0), this.uniqueSets.get(1), this.uniqueSets.get(2));
   Assert.assertEquals(UnifiedSet.newSetWith(), names);
 }
 private <E> Procedure2<Set<E>, E[]> containsExactlyProcedure() {
   return (set, elements) -> Assert.assertEquals(UnifiedSet.newSetWith(elements), set);
 }
 private <E> UnifiedSet<E> newUnsortedSet(E... elements) {
   return UnifiedSet.newSetWith(elements);
 }
 @SafeVarargs
 @Override
 protected final <V> UnifiedSet<V> createCollection(V... args) {
   return UnifiedSet.newSetWith(args);
 }