@Override
 @Test
 public void reject() {
   Verify.assertContainsAll(this.newWith(1, 2, 3, 4).reject(Predicates.lessThan(3)), 3, 4);
   Verify.assertContainsAll(
       this.newWith(1, 2, 3, 4).reject(Predicates.lessThan(3), UnifiedSet.newSet()), 3, 4);
 }
  @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 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 toMap() {
   MutableList<Integer> integers = SingletonListTest.newWith(1);
   MutableMap<Integer, Integer> map =
       integers.toMap(Functions.getIntegerPassThru(), Functions.getIntegerPassThru());
   Verify.assertContainsAll(map.keySet(), 1);
   Verify.assertContainsAll(map.values(), 1);
 }
 @Test
 public void collectIf() {
   Verify.assertContainsAll(
       SingletonListTest.newWith(1).collectIf(Integer.class::isInstance, String::valueOf), "1");
   Verify.assertContainsAll(
       SingletonListTest.newWith(1)
           .collectIf(Integer.class::isInstance, String::valueOf, FastList.<String>newList()),
       "1");
 }
 @Override
 @Test
 public void collectWith() {
   Function2<Integer, Integer, Integer> addZeroFunction = (each, parameter) -> each + parameter;
   Verify.assertContainsAll(
       MultiReaderFastList.newListWith(1, 2, 3).collectWith(addZeroFunction, 0), 1, 2, 3);
   Verify.assertContainsAll(
       MultiReaderFastList.newListWith(1, 2, 3)
           .collectWith(addZeroFunction, 0, FastList.newList()),
       1,
       2,
       3);
 }
 @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));
 }
 @Test
 public void forEachWithIndex() {
   MutableList<Integer> result = Lists.mutable.of();
   MutableList<Integer> collection = SingletonListTest.newWith(1);
   collection.forEachWithIndex((object, index) -> result.add(object + index));
   Verify.assertContainsAll(result, 1);
 }
 @Test
 public void toSet() {
   Interval interval = Interval.evensFromTo(0, 10);
   MutableSet<Integer> set = interval.toSet();
   Verify.assertContainsAll(set, 0, 2, 4, 6, 8, 10);
   Verify.assertSize(6, set);
 }
 @Test
 public void collectOnFromToInterval() {
   Interval interval = Interval.oneTo(5);
   LazyIterable<String> result = interval.collect(String::valueOf);
   Verify.assertIterableSize(5, result);
   Verify.assertContainsAll(result, "1", "5");
 }
  @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 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 toSet() {
   MutableList<Integer> integers = this.newWith(1, 2, 3, 4);
   MutableSet<Integer> set = integers.toSet();
   Verify.assertContainsAll(set, 1, 2, 3, 4);
 }
 @Test
 public void removeUsingPredicate() {
   MutableList<Integer> objects = MultiReaderFastList.newListWith(1, 2, 3, null);
   Assert.assertTrue(objects.removeIf(Predicates.isNull()));
   Verify.assertSize(3, objects);
   Verify.assertContainsAll(objects, 1, 2, 3);
 }
 @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 removeIfWith() {
   MutableList<Integer> objects = MultiReaderFastList.newListWith(1, 2, 3, null);
   Assert.assertTrue(objects.removeIfWith((each, ignored) -> each == null, null));
   Verify.assertSize(3, objects);
   Verify.assertContainsAll(objects, 1, 2, 3);
 }
 @Test
 public void toList() {
   MutableList<Integer> list = SingletonListTest.newWith(1).toList();
   list.add(2);
   list.add(3);
   list.add(4);
   Verify.assertContainsAll(list, 1, 2, 3, 4);
 }
  @Test
  public void setKeyPreservation() {
    Key key = new Key("key");

    Key duplicateKey1 = new Key("key");
    ImmutableSet<Key> set1 = Sets.immutable.of(key, duplicateKey1);
    Verify.assertSize(1, set1);
    Verify.assertContains(key, set1);
    Assert.assertSame(key, set1.getFirst());

    Key duplicateKey2 = new Key("key");
    ImmutableSet<Key> set2 = Sets.immutable.of(key, duplicateKey1, duplicateKey2);
    Verify.assertSize(1, set2);
    Verify.assertContains(key, set2);
    Assert.assertSame(key, set2.getFirst());

    Key duplicateKey3 = new Key("key");
    ImmutableSet<Key> set3 = Sets.immutable.of(key, new Key("not a dupe"), duplicateKey3);
    Verify.assertSize(2, set3);
    Verify.assertContainsAll("immutable set", set3, key, new Key("not a dupe"));
    Assert.assertSame(key, set3.detect(key::equals));

    Key duplicateKey4 = new Key("key");
    ImmutableSet<Key> set4 =
        Sets.immutable.of(key, new Key("not a dupe"), duplicateKey3, duplicateKey4);
    Verify.assertSize(2, set4);
    Verify.assertContainsAll("immutable set", set4, key, new Key("not a dupe"));
    Assert.assertSame(key, set4.detect(key::equals));

    ImmutableSet<Key> set5 =
        Sets.immutable.of(key, new Key("not a dupe"), new Key("me neither"), duplicateKey4);
    Verify.assertSize(3, set5);
    Verify.assertContainsAll(
        "immutable set", set5, key, new Key("not a dupe"), new Key("me neither"));
    Assert.assertSame(key, set5.detect(key::equals));

    ImmutableSet<Key> set6 = Sets.immutable.of(key, duplicateKey2, duplicateKey3, duplicateKey4);
    Verify.assertSize(1, set6);
    Verify.assertContains(key, set6);
    Assert.assertSame(key, set6.detect(key::equals));
  }
  @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 intervalToSet() {
   MutableSet<Integer> set = Interval.toSet(1, 5);
   Verify.assertSize(5, set);
   Verify.assertContainsAll(set, 1, 2, 3, 4, 5);
 }
 @Test
 public void testValues() {
   Verify.assertContainsAll(this.mutableMap.values(), this.unmodifiableMap.values().toArray());
 }
 @Test
 public void select() {
   Verify.assertContainsAll(SingletonListTest.newWith(1).select(Predicates.lessThan(3)), 1);
   Verify.assertEmpty(SingletonListTest.newWith(1).select(Predicates.greaterThan(3)));
 }
 @Test
 public void collect() {
   Verify.assertContainsAll(SingletonListTest.newWith(1).collect(String::valueOf), "1");
   Verify.assertContainsAll(
       SingletonListTest.newWith(1).collect(String::valueOf, UnifiedSet.<String>newSet()), "1");
 }
 @Test
 public void intervalToList() {
   MutableList<Integer> list = Interval.fromTo(1, 5).toList();
   Verify.assertSize(5, list);
   Verify.assertContainsAll(list, 1, 2, 3, 4, 5);
 }
 @Test
 public void toSet() {
   MutableList<Integer> integers = SingletonListTest.newWith(1);
   MutableSet<Integer> set = integers.toSet();
   Verify.assertContainsAll(set, 1);
 }