// Path: miniguava-collect-immutables/src/main/java/net/ypresto/miniguava/collect/immutables/ImmutableSet.java
// public static class Builder<E> extends ImmutableCollection.ArrayBasedBuilder<E> {
// 
//   /**
//    * Creates a new builder. The returned builder is equivalent to the builder
//    * generated by {@link ImmutableSet#builder}.
//    */
//   public Builder() {
//     this(DEFAULT_INITIAL_CAPACITY);
//   }
// 
//   Builder(int capacity) {
//     super(capacity);
//   }
// 
//   /**
//    * Adds {@code element} to the {@code ImmutableSet}.  If the {@code
//    * ImmutableSet} already contains {@code element}, then {@code add} has no
//    * effect (only the previously added element is retained).
//    *
//    * @param element the element to add
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code element} is null
//    */
//   @Override
//   public Builder<E> add(E element) {
//     super.add(element);
//     return this;
//   }
// 
//   /**
//    * Adds each element of {@code elements} to the {@code ImmutableSet},
//    * ignoring duplicate elements (only the first duplicate element is added).
//    *
//    * @param elements the elements to add
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code elements} is null or contains a
//    *     null element
//    */
//   @Override
//   public Builder<E> add(E... elements) {
//     super.add(elements);
//     return this;
//   }
// 
//   /**
//    * Adds each element of {@code elements} to the {@code ImmutableSet},
//    * ignoring duplicate elements (only the first duplicate element is added).
//    *
//    * @param elements the {@code Collection} to add to the {@code ImmutableSet}
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code elements} is null or contains a
//    *     null element
//    */
//   @Override
//   public Builder<E> addAll(Collection<? extends E> elements) {
//     super.addAll(elements);
//     return this;
//   }
// 
//   /**
//    * Returns a newly-created {@code ImmutableSet} based on the contents of
//    * the {@code Builder}.
//    */
//   @Override
//   public ImmutableSet<E> build() {
//     ImmutableSet<E> result = construct(size, contents);
//     // construct has the side effect of deduping contents, so we update size
//     // accordingly.
//     size = result.size();
//     return result;
//   }
// }


import net.ypresto.miniguava.collect.immutables.ImmutableSet.Builder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.testing.ListTestSuiteBuilder;
import com.google.common.collect.testing.SetTestSuiteBuilder;
import com.google.common.collect.testing.features.CollectionFeature;
import com.google.common.collect.testing.features.CollectionSize;
import com.google.common.collect.testing.google.SetGenerators.DegeneratedImmutableSetGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetAsListGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetCopyOfGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetWithBadHashesGenerator;
import com.google.common.testing.EqualsTester;
import junit.framework.Test;
import junit.framework.TestSuite;
      ImmutableSet.chooseTableSize(1 << 30);
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testResizeTable() {
    verifyTableSize(100, 2, 4);
    verifyTableSize(100, 5, 8);
    verifyTableSize(100, 33, 64);
    verifyTableSize(17, 17, 32);
    verifyTableSize(17, 16, 32);
    verifyTableSize(17, 15, 32);
  }

  private void verifyTableSize(int inputSize, int setSize, int tableSize) {
    Builder<Integer> builder = ImmutableSet.builder();
    for (int i = 0; i < inputSize; i++) {
      builder.add(i % setSize);
    }
    ImmutableSet<Integer> set = builder.build();
    assertTrue(set instanceof RegularImmutableSet);
    assertEquals("Input size " + inputSize + " and set size " + setSize,
        tableSize, ((RegularImmutableSet<Integer>) set).table.length);
  }

  public void testCopyOf_threadSafe() {
    verifyThreadSafe();
  }

// Path: miniguava-collect-immutables/src/main/java/net/ypresto/miniguava/collect/immutables/ImmutableSet.java
// public static class Builder<E> extends ImmutableCollection.ArrayBasedBuilder<E> {
// 
//   /**
//    * Creates a new builder. The returned builder is equivalent to the builder
//    * generated by {@link ImmutableSet#builder}.
//    */
//   public Builder() {
//     this(DEFAULT_INITIAL_CAPACITY);
//   }
// 
//   Builder(int capacity) {
//     super(capacity);
//   }
// 
//   /**
//    * Adds {@code element} to the {@code ImmutableSet}.  If the {@code
//    * ImmutableSet} already contains {@code element}, then {@code add} has no
//    * effect (only the previously added element is retained).
//    *
//    * @param element the element to add
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code element} is null
//    */
//   @Override
//   public Builder<E> add(E element) {
//     super.add(element);
//     return this;
//   }
// 
//   /**
//    * Adds each element of {@code elements} to the {@code ImmutableSet},
//    * ignoring duplicate elements (only the first duplicate element is added).
//    *
//    * @param elements the elements to add
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code elements} is null or contains a
//    *     null element
//    */
//   @Override
//   public Builder<E> add(E... elements) {
//     super.add(elements);
//     return this;
//   }
// 
//   /**
//    * Adds each element of {@code elements} to the {@code ImmutableSet},
//    * ignoring duplicate elements (only the first duplicate element is added).
//    *
//    * @param elements the {@code Collection} to add to the {@code ImmutableSet}
//    * @return this {@code Builder} object
//    * @throws NullPointerException if {@code elements} is null or contains a
//    *     null element
//    */
//   @Override
//   public Builder<E> addAll(Collection<? extends E> elements) {
//     super.addAll(elements);
//     return this;
//   }
// 
//   /**
//    * Returns a newly-created {@code ImmutableSet} based on the contents of
//    * the {@code Builder}.
//    */
//   @Override
//   public ImmutableSet<E> build() {
//     ImmutableSet<E> result = construct(size, contents);
//     // construct has the side effect of deduping contents, so we update size
//     // accordingly.
//     size = result.size();
//     return result;
//   }
// }


// Path: miniguava-collect-immutables/src/test/java/net/ypresto/miniguava/collect/immutables/ImmutableSetTest.java
import net.ypresto.miniguava.collect.immutables.ImmutableSet.Builder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.testing.ListTestSuiteBuilder;
import com.google.common.collect.testing.SetTestSuiteBuilder;
import com.google.common.collect.testing.features.CollectionFeature;
import com.google.common.collect.testing.features.CollectionSize;
import com.google.common.collect.testing.google.SetGenerators.DegeneratedImmutableSetGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetAsListGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetCopyOfGenerator;
import com.google.common.collect.testing.google.SetGenerators.ImmutableSetWithBadHashesGenerator;
import com.google.common.testing.EqualsTester;
import junit.framework.Test;
import junit.framework.TestSuite;

      ImmutableSet.chooseTableSize(1 << 30);
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testResizeTable() {
    verifyTableSize(100, 2, 4);
    verifyTableSize(100, 5, 8);
    verifyTableSize(100, 33, 64);
    verifyTableSize(17, 17, 32);
    verifyTableSize(17, 16, 32);
    verifyTableSize(17, 15, 32);
  }

  private void verifyTableSize(int inputSize, int setSize, int tableSize) {
    Builder<Integer> builder = ImmutableSet.builder();
    for (int i = 0; i < inputSize; i++) {
      builder.add(i % setSize);
    }
    ImmutableSet<Integer> set = builder.build();
    assertTrue(set instanceof RegularImmutableSet);
    assertEquals("Input size " + inputSize + " and set size " + setSize,
        tableSize, ((RegularImmutableSet<Integer>) set).table.length);
  }

  public void testCopyOf_threadSafe() {
    verifyThreadSafe();
  }

  @Override <E extends Comparable<E>> Builder<E> builder() {