@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);
  }
 @Override
 @Test
 public void addAllAtIndex() {
   MutableList<Integer> integers = this.newWith(5);
   integers.addAll(0, Lists.fixedSize.of(1, 2, 3, 4));
   Verify.assertStartsWith(integers, 1, 2, 3, 4, 5);
   integers.addAll(0, this.newWith(-3, -2, -1, 0));
   Verify.assertStartsWith(integers, -3, -2, -1, 0, 1, 2, 3, 4, 5);
 }
 @Test
 public void sortThisOnListWithMoreThan9Elements() {
   MutableList<Integer> integers = this.newWith(2, 3, 4, 1, 5, 7, 6, 8, 10, 9);
   Verify.assertStartsWith(integers.sortThis(), 1, 2, 3, 4);
   MutableList<Integer> integers2 = this.newWith(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
   Verify.assertStartsWith(
       integers2.sortThis(Collections.reverseOrder()), 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   MutableList<Integer> integers3 = this.newWith(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
   Verify.assertStartsWith(integers3.sortThis(), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
 }
 @Test
 public void toSortedList() {
   MutableList<Integer> integers = SingletonListTest.newWith(1);
   MutableList<Integer> list = integers.toSortedList(Collections.<Integer>reverseOrder());
   Verify.assertStartsWith(list, 1);
   Assert.assertNotSame(integers, list);
   MutableList<Integer> list2 = integers.toSortedList();
   Verify.assertStartsWith(list2, 1);
   Assert.assertNotSame(integers, list2);
 }
 @Test
 public void sortThisOnListWithLessThan10Elements() {
   MutableList<Integer> integers = this.newWith(2, 3, 4, 1, 7, 9, 6, 8, 5);
   Verify.assertStartsWith(integers.sortThis(), 1, 2, 3, 4, 5, 6, 7, 8, 9);
   MutableList<Integer> integers2 = this.newWith(1, 2, 3, 4, 5, 6, 7, 8, 9);
   Verify.assertStartsWith(
       integers2.sortThis(Collections.reverseOrder()), 9, 8, 7, 6, 5, 4, 3, 2, 1);
   MutableList<Integer> integers3 = this.newWith(1, 2, 3, 4, 5, 6, 7, 8, 9);
   Verify.assertStartsWith(integers3.sortThis(), 1, 2, 3, 4, 5, 6, 7, 8, 9);
   Verify.assertInstanceOf(MultiReaderFastList.class, integers3.sortThis());
 }
  @Override
  @Test
  public void addAllIterable() {
    super.addAllIterable();

    MutableList<Integer> integers = MultiReaderFastList.newList();
    Assert.assertTrue(integers.addAllIterable(Lists.fixedSize.of(1, 2, 3, 4)));
    Verify.assertContainsAll(integers, 1, 2, 3, 4);
    Assert.assertTrue(integers.addAllIterable(FastList.<Integer>newList(4).with(1, 2, 3, 4)));
    Verify.assertStartsWith(integers, 1, 2, 3, 4, 1, 2, 3, 4);
    Assert.assertTrue(integers.addAllIterable(Sets.fixedSize.of(5)));
    Verify.assertStartsWith(integers, 1, 2, 3, 4, 1, 2, 3, 4, 5);
  }
 @Test
 public void addAllAtIndexEmpty() {
   MutableList<Integer> integers = this.newWith(5);
   integers.addAll(0, Lists.fixedSize.of());
   Verify.assertSize(1, integers);
   Verify.assertStartsWith(integers, 5);
   integers.addAll(0, FastList.newList(4));
   Verify.assertSize(1, integers);
   Verify.assertStartsWith(integers, 5);
   integers.addAll(0, Sets.fixedSize.of());
   Verify.assertSize(1, integers);
   Verify.assertStartsWith(integers, 5);
   FastList<String> zeroSizedList = FastList.newList(0);
   zeroSizedList.addAll(0, this.newWith("1", "2"));
 }
 @Override
 @Test
 public void toList() {
   MutableList<Integer> integers = this.newWith(1, 2, 3, 4);
   MutableList<Integer> list = integers.toList();
   Verify.assertStartsWith(list, 1, 2, 3, 4);
 }
 @Test
 public void toFastList() {
   Interval interval = Interval.evensFromTo(0, 10);
   FastList<Integer> toList = (FastList<Integer>) interval.toList();
   Verify.assertStartsWith(toList, 0, 2, 4, 6, 8, 10);
   Verify.assertSize(6, toList);
 }
 @Test
 public void serializationOfSublist() {
   MutableList<Integer> collection = this.newWith(1, 2, 3, 4, 5);
   MutableList<Integer> deserializedCollection =
       SerializeTestHelper.serializeDeserialize(collection.subList(0, 2));
   Verify.assertSize(2, deserializedCollection);
   Verify.assertStartsWith(deserializedCollection, 1, 2);
   Assert.assertEquals(collection.subList(0, 2), deserializedCollection);
 }
 @Override
 @Test
 public void serialization() {
   MutableList<Integer> collection = this.newWith(1, 2, 3, 4, 5);
   MutableList<Integer> deserializedCollection =
       SerializeTestHelper.serializeDeserialize(collection);
   Verify.assertSize(5, deserializedCollection);
   Verify.assertStartsWith(deserializedCollection, 1, 2, 3, 4, 5);
   Assert.assertEquals(collection, deserializedCollection);
 }
  @Override
  @Test
  public void removeObject() {
    super.removeObject();

    MutableList<Integer> integers = this.newWith(1, 2, 3, 4);
    Integer doesExist = 1;
    integers.remove(doesExist);
    Verify.assertStartsWith(integers, 2, 3, 4);
    Integer doesNotExist = 5;
    Assert.assertFalse(integers.remove(doesNotExist));
  }
 @Test
 public void subListOfSubList() {
   MutableList<String> list = this.newWith("A", "B", "C", "D");
   MutableList<String> sublist = list.subList(0, 3);
   MutableList<String> sublist2 = sublist.subList(0, 2);
   Verify.assertSize(2, sublist2);
   Verify.assertContainsAll(sublist, "A", "B");
   sublist2.add("X");
   Verify.assertSize(3, sublist2);
   Verify.assertStartsWith(sublist2, "A", "B", "X");
   Verify.assertContainsAll(sublist, "A", "B", "C", "X");
   Assert.assertEquals("X", sublist2.remove(2));
   Verify.assertSize(2, sublist2);
   Verify.assertContainsNone(sublist, "X");
   Verify.assertContainsNone(sublist2, "X");
 }
 @Override
 @Test
 public void addAtIndex() {
   MutableList<Integer> integers = this.newWith(1, 2, 3, 5);
   integers.add(3, 4);
   Verify.assertStartsWith(integers, 1, 2, 3, 4, 5);
   integers.add(5, 6);
   Verify.assertStartsWith(integers, 1, 2, 3, 4, 5, 6);
   integers.add(0, 0);
   Verify.assertStartsWith(integers, 0, 1, 2, 3, 4, 5, 6);
   FastList<String> zeroSizedList = FastList.newList(0);
   zeroSizedList.add(0, "1");
   Verify.assertStartsWith(zeroSizedList, "1");
   zeroSizedList.add(1, "3");
   Verify.assertStartsWith(zeroSizedList, "1", "3");
   zeroSizedList.add(1, "2");
   Verify.assertStartsWith(zeroSizedList, "1", "2", "3");
   MutableList<Integer> midList = FastList.<Integer>newList(2).with(1, 3);
   midList.add(1, 2);
   Verify.assertStartsWith(midList, 1, 2, 3);
   Verify.assertThrows(IndexOutOfBoundsException.class, () -> midList.add(-1, -1));
 }
 @Test
 public void setAtIndex() {
   MutableList<Integer> integers = this.newWith(1, 2, 3, 5);
   Assert.assertEquals(Integer.valueOf(5), integers.set(3, 4));
   Verify.assertStartsWith(integers, 1, 2, 3, 4);
 }
 @Test
 public void intervalAsReverseList() {
   MutableList<Integer> list = Interval.toReverseList(1, 5);
   Verify.assertSize(5, list);
   Verify.assertStartsWith(list, 5, 4, 3, 2, 1);
 }