@Test
 public void toList() {
   MutableBooleanCollection collection = this.newWith(true, false);
   Assert.assertTrue(
       BooleanArrayList.newListWith(false, true).equals(collection.toList())
           || BooleanArrayList.newListWith(true, false).equals(collection.toList()));
 }
  @Override
  @Test
  public void removeAllIterable() {
    Assert.assertFalse(this.newWith().removeAll(new BooleanArrayList()));

    ObjectBooleanHashMap<Integer> map =
        ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection = map.values();
    Assert.assertFalse(collection.removeAll());

    Assert.assertTrue(collection.removeAll(BooleanArrayList.newListWith(false)));
    Assert.assertFalse(collection.contains(false));
    Assert.assertTrue(collection.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.contains(true));

    Assert.assertTrue(collection.removeAll(BooleanArrayList.newListWith(true)));
    Assert.assertTrue(collection.isEmpty());
    Assert.assertFalse(collection.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.isEmpty());

    ObjectBooleanHashMap<Integer> map1 =
        ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection1 = map1.values();
    Assert.assertTrue(collection1.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(collection1.isEmpty());
    Assert.assertFalse(collection1.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map1.contains(true));
    Assert.assertFalse(map1.contains(false));
    Assert.assertTrue(map1.isEmpty());
  }
 public BooleanArrayList reject(BooleanPredicate predicate) {
   BooleanArrayList result = new BooleanArrayList();
   for (int i = 0; i < this.size; i++) {
     boolean item = this.items.get(i);
     if (!predicate.accept(item)) {
       result.add(item);
     }
   }
   return result;
 }
 @Override
 @Test
 public void containsAllIterable() {
   Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true, false)));
   Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true, true)));
   Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(false, false)));
   Assert.assertFalse(this.getEmptyMap().containsAll(BooleanArrayList.newListWith(false, true)));
   Assert.assertFalse(
       this.newWithKeysValues("0", true).containsAll(BooleanArrayList.newListWith(false)));
 }
 public BooleanIterable reject(BooleanPredicate predicate) {
   BooleanArrayList result = new BooleanArrayList(BooleanArrayList.this.size);
   BooleanIterator iterator = this.booleanIterator();
   while (iterator.hasNext()) {
     boolean value = iterator.next();
     if (!predicate.accept(value)) {
       result.add(value);
     }
   }
   return result;
 }
 @Test
 public void containsAllIterable() {
   MutableBooleanCollection emptyCollection = this.getEmptyCollection();
   Assert.assertTrue(emptyCollection.containsAll(new BooleanArrayList()));
   Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
   emptyCollection.add(false);
   Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
   MutableBooleanCollection collection = this.classUnderTest();
   Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(true)));
   Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(true, false, true)));
 }
 @Override
 public void containsAllIterable() {
   MutableBooleanCollection emptyCollection1 = this.newWith();
   Assert.assertTrue(emptyCollection1.containsAll(new BooleanArrayList()));
   Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(true)));
   Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(false)));
   MutableBooleanCollection collection = this.classUnderTest();
   Assert.assertTrue(collection.containsAll(new BooleanArrayList()));
   Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(true)));
   Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false)));
   Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false, true)));
 }
  @Test
  public void toList() {
    MutableObjectBooleanMap<String> map1 = this.newWithKeysValues(null, true, "1", false);
    MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
    MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);

    Assert.assertTrue(
        map1.toList().toString(),
        BooleanArrayList.newListWith(true, false).equals(map1.toList())
            || BooleanArrayList.newListWith(false, true).equals(map1.toList()));
    Assert.assertEquals(BooleanArrayList.newListWith(true), map2.toList());
    Assert.assertEquals(BooleanArrayList.newListWith(false), map3.toList());
  }
 @Override
 @Test
 public void peek() {
   Assert.assertTrue(this.classUnderTest().peek());
   Assert.assertEquals(BooleanArrayList.newListWith(), this.classUnderTest().peek(0));
   Assert.assertEquals(BooleanArrayList.newListWith(true), this.classUnderTest().peek(1));
   Verify.assertThrows(
       IllegalArgumentException.class,
       new Runnable() {
         public void run() {
           ImmutableBooleanSingletonStackTest.this.classUnderTest().peek(2);
         }
       });
 }
  @Override
  @Test
  public void booleanIterator() {
    MutableBooleanCollection bag = this.newWith(true, false, true, true);
    BooleanArrayList list = BooleanArrayList.newListWith(true, false, true, true);
    final BooleanIterator iterator = bag.booleanIterator();
    for (int i = 0; i < 4; i++) {
      Assert.assertTrue(iterator.hasNext());
      Assert.assertTrue(list.remove(iterator.next()));
    }
    Verify.assertEmpty(list);
    Assert.assertFalse(iterator.hasNext());

    Verify.assertThrows(
        NoSuchElementException.class,
        new Runnable() {
          public void run() {
            iterator.next();
          }
        });
  }
 @Override
 @Test
 public void testEquals() {
   ImmutableBooleanStack stack = this.classUnderTest();
   Assert.assertEquals(stack, stack);
   Verify.assertPostSerializedEqualsAndHashCode(stack);
   Assert.assertEquals(stack, BooleanArrayStack.newStackWith(true));
   Assert.assertNotEquals(stack, this.newWith(true, false));
   Assert.assertNotEquals(stack, BooleanArrayList.newListWith(true));
   Assert.assertEquals(stack, this.newWith(true));
   Assert.assertNotEquals(stack, this.newWith());
 }
  @Override
  public void containsAllIterable() {
    super.containsAllIterable();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.clear();

    map1.put("5", true);
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(false, false)));

    map1.put(null, false);
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(true, false)));

    map1.removeKey("5");
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(false, false)));

    map1.removeKey(null);
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(false, true)));
  }
 public MutableBooleanList toList() {
   return BooleanArrayList.newList(this);
 }
  @Test
  public void containsAllIterable() {
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true, true)));
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(false, false)));
    this.map.clear();

    this.map.put("5", true);
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(this.map.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertFalse(this.map.containsAll(BooleanArrayList.newListWith(false, false)));

    this.map.put(null, false);
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(true, false)));

    this.map.removeKey("5");
    Assert.assertFalse(this.map.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(this.map.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(this.map.containsAll(BooleanArrayList.newListWith(false, false)));

    this.map.removeKey(null);
    Assert.assertFalse(this.map.containsAll(BooleanArrayList.newListWith(false, true)));
  }
 private LazyIterable<Boolean> newPrimitiveWith(boolean... elements) {
   return new CollectBooleanToObjectIterable<>(
       BooleanArrayList.newListWith(elements), Boolean::valueOf);
 }