@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 addAllEmpty() {
   MutableList<Integer> integers = MultiReaderFastList.newList();
   integers.addAll(Lists.fixedSize.of());
   Verify.assertEmpty(integers);
   integers.addAll(Sets.fixedSize.of());
   Verify.assertEmpty(integers);
   integers.addAll(FastList.newList());
   Verify.assertEmpty(integers);
   integers.addAll(ArrayAdapter.newArray());
   Verify.assertEmpty(integers);
 }
 @Test
 public void mutableSet() {
   MutableSetMultimap<Integer, Integer> empty = Multimaps.mutable.set.of();
   MutableSetMultimap<Integer, Integer> emptyWith = Multimaps.mutable.set.with();
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   MutableSetMultimap<Integer, Integer> one = Multimaps.mutable.set.of(1, 1);
   Assert.assertEquals(UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1)), one);
   MutableSetMultimap<Integer, Integer> two = Multimaps.mutable.set.of(1, 1, 2, 2);
   Assert.assertEquals(UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   MutableSetMultimap<Integer, Integer> three = Multimaps.mutable.set.of(1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       UnifiedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
 @Test
 public void immutableBag() {
   ImmutableBagMultimap<Integer, Integer> empty = Multimaps.immutable.bag.of();
   ImmutableBagMultimap<Integer, Integer> emptyWith = Multimaps.immutable.bag.with();
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   ImmutableBagMultimap<Integer, Integer> one = Multimaps.immutable.bag.of(1, 1);
   Assert.assertEquals(HashBagMultimap.newMultimap(Tuples.pair(1, 1)), one);
   ImmutableBagMultimap<Integer, Integer> two = Multimaps.immutable.bag.of(1, 1, 2, 2);
   Assert.assertEquals(HashBagMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   ImmutableBagMultimap<Integer, Integer> three = Multimaps.immutable.bag.of(1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       HashBagMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
  @Override
  @Test
  public void removeAllIterable() {
    super.removeAllIterable();

    MutableList<Integer> objects = MultiReaderFastList.newListWith(1, 2, 3);
    objects.removeAllIterable(Lists.fixedSize.of(1, 2));
    Verify.assertSize(1, objects);
    Verify.assertContains(3, objects);
    MutableList<Integer> objects2 = MultiReaderFastList.newListWith(1, 2, 3);
    objects2.removeAllIterable(Lists.fixedSize.of(1));
    Verify.assertSize(2, objects2);
    Verify.assertContainsAll(objects2, 2, 3);
    MutableList<Integer> objects3 = MultiReaderFastList.newListWith(1, 2, 3);
    objects3.removeAllIterable(Lists.fixedSize.of(3));
    Verify.assertSize(2, objects3);
    Verify.assertContainsAll(objects3, 1, 2);
    MutableList<Integer> objects4 = MultiReaderFastList.newListWith(1, 2, 3);
    objects4.removeAllIterable(Lists.fixedSize.of());
    Verify.assertSize(3, objects4);
    Verify.assertContainsAll(objects4, 1, 2, 3);
    MutableList<Integer> objects5 = MultiReaderFastList.newListWith(1, 2, 3);
    objects5.removeAllIterable(Lists.fixedSize.of(1, 2, 3));
    Verify.assertEmpty(objects5);
    MutableList<Integer> objects6 = MultiReaderFastList.newListWith(1, 2, 3);
    objects6.removeAllIterable(Lists.fixedSize.of(2));
    Verify.assertSize(2, objects6);
    Verify.assertContainsAll(objects6, 1, 3);
  }
 @Override
 @Test
 public void isEmpty() {
   Verify.assertEmpty(MultiReaderFastList.newList());
   Verify.assertNotEmpty(MultiReaderFastList.newListWith(1, 2));
   Assert.assertTrue(MultiReaderFastList.newListWith(1, 2).notEmpty());
 }
 @Override
 @Test
 public void rejectWith() {
   MutableList<Integer> list = this.getIntegerList();
   MutableList<Integer> results = list.rejectWith(Predicates2.instanceOf(), Integer.class);
   Verify.assertEmpty(results);
 }
 @Test
 public void selectAndRejectWith() {
   MutableList<Integer> objects = SingletonListTest.newWith(1);
   Twin<MutableList<Integer>> result = objects.selectAndRejectWith(Object::equals, 1);
   Verify.assertSize(1, result.getOne());
   Verify.assertEmpty(result.getTwo());
 }
 @Test
 public void selectWith() {
   Verify.assertContainsAll(
       SingletonListTest.newWith(1).selectWith(Predicates2.<Integer>lessThan(), 3), 1);
   Verify.assertEmpty(
       SingletonListTest.newWith(1).selectWith(Predicates2.<Integer>greaterThan(), 3));
 }
  @Override
  @Test
  public void retainAllIterable() {
    super.retainAllIterable();

    MutableList<Integer> objects = this.newWith(1, 2, 3);
    objects.retainAllIterable(Lists.fixedSize.of(1, 2));
    Verify.assertSize(2, objects);
    Verify.assertContainsAll(objects, 1, 2);
    MutableList<Integer> objects2 = this.newWith(1, 2, 3);
    objects2.retainAllIterable(Lists.fixedSize.of(1));
    Verify.assertSize(1, objects2);
    Verify.assertContainsAll(objects2, 1);
    MutableList<Integer> objects3 = this.newWith(1, 2, 3);
    objects3.retainAllIterable(Lists.fixedSize.of(3));
    Verify.assertSize(1, objects3);
    Verify.assertContainsAll(objects3, 3);
    MutableList<Integer> objects4 = this.newWith(1, 2, 3);
    objects4.retainAllIterable(Lists.fixedSize.of(2));
    Verify.assertSize(1, objects4);
    Verify.assertContainsAll(objects4, 2);
    MutableList<Integer> objects5 = this.newWith(1, 2, 3);
    objects5.retainAllIterable(Lists.fixedSize.of());
    Verify.assertEmpty(objects5);
    MutableList<Integer> objects6 = this.newWith(1, 2, 3);
    objects6.retainAllIterable(Lists.fixedSize.of(1, 2, 3));
    Verify.assertSize(3, objects6);
    Verify.assertContainsAll(objects6, 1, 2, 3);
  }
 @Override
 @Test
 public void subList() {
   super.subList();
   MutableList<String> list = this.newWith("A", "B", "C", "D");
   MutableList<String> sublist = list.subList(1, 3);
   Verify.assertPostSerializedEqualsAndHashCode(sublist);
   Verify.assertSize(2, sublist);
   Verify.assertContainsAll(sublist, "B", "C");
   sublist.add("X");
   Verify.assertSize(3, sublist);
   Verify.assertContainsAll(sublist, "B", "C", "X");
   Verify.assertSize(5, list);
   Verify.assertContainsAll(list, "A", "B", "C", "X", "D");
   sublist.remove("X");
   Verify.assertContainsAll(sublist, "B", "C");
   Verify.assertContainsAll(list, "A", "B", "C", "D");
   Assert.assertEquals("C", sublist.set(1, "R"));
   Verify.assertContainsAll(sublist, "B", "R");
   Verify.assertContainsAll(list, "A", "B", "R", "D");
   sublist.addAll(Arrays.asList("W", "G"));
   Verify.assertContainsAll(sublist, "B", "R", "W", "G");
   Verify.assertContainsAll(list, "A", "B", "R", "W", "G", "D");
   sublist.clear();
   Verify.assertEmpty(sublist);
   Verify.assertContainsAll(list, "A", "D");
 }
 @Test
 public void rejectWith() {
   Verify.assertEmpty(SingletonListTest.newWith(1).rejectWith(Predicates2.<Integer>lessThan(), 3));
   Verify.assertContainsAll(
       SingletonListTest.newWith(1)
           .rejectWith(Predicates2.<Integer>greaterThan(), 3, UnifiedSet.<Integer>newSet()),
       1);
 }
 @Override
 @Test
 public void clear() {
   MutableList<Integer> integers = this.newWith(1, 2, 3, 4);
   Verify.assertNotEmpty(integers);
   integers.clear();
   Verify.assertEmpty(integers);
 }
 @Test
 public void immutableSortedSet() {
   ImmutableSortedSetMultimap<Integer, Integer> empty =
       Multimaps.immutable.sortedSet.of(Integer::compareTo);
   ImmutableSortedSetMultimap<Integer, Integer> emptyWith =
       Multimaps.immutable.sortedSet.with(Integer::compareTo);
   Verify.assertEmpty(empty);
   Verify.assertEmpty(emptyWith);
   ImmutableSortedSetMultimap<Integer, Integer> one =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1);
   Assert.assertEquals(TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1)), one);
   ImmutableSortedSetMultimap<Integer, Integer> two =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1, 2, 2);
   Assert.assertEquals(
       TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2)), two);
   ImmutableSortedSetMultimap<Integer, Integer> three =
       Multimaps.immutable.sortedSet.of(Integer::compareTo, 1, 1, 2, 2, 3, 3);
   Assert.assertEquals(
       TreeSortedSetMultimap.newMultimap(Tuples.pair(1, 1), Tuples.pair(2, 2), Tuples.pair(3, 3)),
       three);
 }
 @Test
 public void removeAllWithWeakReference() {
   String fred = new String("Fred"); // Deliberate String copy for unit test purpose
   String wilma = new String("Wilma"); // Deliberate String copy for unit test purpose
   MutableList<String> objects = MultiReaderFastList.newListWith(fred, wilma);
   objects.removeAll(Lists.fixedSize.of("Fred"));
   objects.remove(0);
   Verify.assertEmpty(objects);
   WeakReference<String> ref = new WeakReference<>(wilma);
   //noinspection ReuseOfLocalVariable
   fred = null; // Deliberate null of a local variable for unit test purpose
   //noinspection ReuseOfLocalVariable
   wilma = null; // Deliberate null of a local variable for unit test purpose
   System.gc();
   Thread.yield();
   System.gc();
   Thread.yield();
   Assert.assertNull(ref.get());
 }
 @Test
 public void select() {
   Verify.assertContainsAll(SingletonListTest.newWith(1).select(Predicates.lessThan(3)), 1);
   Verify.assertEmpty(SingletonListTest.newWith(1).select(Predicates.greaterThan(3)));
 }
 @Override
 @Test
 public void flipUniqueValues() {
   Verify.assertEmpty(this.classUnderTest().flipUniqueValues());
 }
 @Override
 @Test
 public void newEmpty() {
   Verify.assertInstanceOf(MultiReaderFastList.class, MultiReaderFastList.newList().newEmpty());
   Verify.assertEmpty(MultiReaderFastList.<Integer>newListWith(null, null).newEmpty());
 }