private void basicCount(RichIterable<Integer> listIterable) {
   int actual1 = ParallelIterate.count(listIterable, Predicates.greaterThan(10000));
   int actual2 =
       ParallelIterate.count(listIterable, Predicates.greaterThan(10000), 11, this.executor);
   Assert.assertEquals(10000, actual1);
   Assert.assertEquals(10000, actual2);
 }
 private void basicReject(RichIterable<Integer> iterable) {
   Collection<Integer> actual1 = ParallelIterate.reject(iterable, Predicates.greaterThan(10000));
   Collection<Integer> actual2 =
       ParallelIterate.reject(
           iterable,
           Predicates.greaterThan(10000),
           HashBag.<Integer>newBag(),
           3,
           this.executor,
           true);
   Collection<Integer> actual3 =
       ParallelIterate.reject(iterable, Predicates.greaterThan(10000), true);
   RichIterable<Integer> expected = iterable.reject(Predicates.greaterThan(10000));
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual1.getClass().getSimpleName(),
       expected,
       actual1);
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual2.getClass().getSimpleName(),
       expected.toBag(),
       actual2);
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual3.getClass().getSimpleName(),
       expected.toBag(),
       HashBag.newBag(actual3));
 }
 @Test
 public void select() {
   ImmutableBag<String> strings = this.newBag();
   Verify.assertContainsAll(
       FastList.newList(strings.select(Predicates.greaterThan("0"))), strings.toArray());
   Verify.assertIterableEmpty(strings.select(Predicates.lessThan("0")));
   Verify.assertIterableSize(strings.size() - 1, strings.select(Predicates.greaterThan("1")));
 }
  @Test
  public void partition() {
    ImmutableBag<String> strings = this.newBag();
    PartitionImmutableBag<String> partition = strings.partition(Predicates.greaterThan("0"));
    Assert.assertEquals(strings, partition.getSelected());
    Verify.assertIterableEmpty(partition.getRejected());

    Verify.assertIterableSize(
        strings.size() - 1, strings.partition(Predicates.greaterThan("1")).getSelected());
  }
 @Test
 public void rejectToTarget() {
   ImmutableBag<String> strings = this.newBag();
   Assert.assertEquals(
       strings, strings.reject(Predicates.lessThan("0"), FastList.<String>newList()).toBag());
   Verify.assertEmpty(strings.reject(Predicates.greaterThan("0"), FastList.<String>newList()));
 }
 @Test
 public void reject() {
   ImmutableBag<String> strings = this.newBag();
   Verify.assertIterableEmpty(strings.reject(Predicates.greaterThan("0")));
   Assert.assertEquals(strings, strings.reject(Predicates.lessThan("0")));
   Verify.assertIterableSize(strings.size() - 1, strings.reject(Predicates.lessThan("2")));
 }
 @Test
 public void selectSortedSet() {
   RichIterable<Integer> iterable = Interval.oneTo(20000).toSortedSet();
   Collection<Integer> actual1 = ParallelIterate.select(iterable, Predicates.greaterThan(10000));
   Collection<Integer> actual2 =
       ParallelIterate.select(iterable, Predicates.greaterThan(10000), true);
   RichIterable<Integer> expected = iterable.select(Predicates.greaterThan(10000));
   Assert.assertSame(expected.getClass(), actual1.getClass());
   Assert.assertSame(expected.getClass(), actual2.getClass());
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual1.getClass().getSimpleName(),
       expected,
       actual1);
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual2.getClass().getSimpleName(),
       expected,
       actual2);
 }
 @Test
 public void testSelect() {
   Assert.assertEquals(
       ArrayStack.newStackFromTopToBottom(2, 3),
       this.unmodifiableStack.select(Predicates.greaterThan(1)));
   Verify.assertSize(
       3,
       this.unmodifiableStackString.select(Predicates.alwaysTrue(), FastList.<String>newList()));
 }
 @Override
 @Test
 public void forEach() {
   super.forEach();
   MutableList<Integer> list = FastList.newList();
   CompositeFastList<Integer> iterables = new CompositeFastList<Integer>();
   iterables.addComposited(Interval.oneTo(5).toList());
   iterables.addComposited(Interval.fromTo(6, 10).toList());
   iterables.forEach(CollectionAddProcedure.on(list));
   Verify.assertSize(10, list);
   Verify.assertAllSatisfy(list, Predicates.greaterThan(0).and(Predicates.lessThan(11)));
 }
 @Override
 @Test
 public void forEachWith() {
   super.forEachWith();
   MutableList<Integer> list = FastList.newList();
   CompositeFastList<Integer> iterables = new CompositeFastList<Integer>();
   iterables.addComposited(Interval.fromTo(6, 10).toList());
   iterables.addComposited(Interval.oneTo(5).toList());
   iterables.forEachWith((each, parameter) -> list.add(parameter.intValue(), each), 0);
   Verify.assertSize(10, list);
   Verify.assertAllSatisfy(list, Predicates.greaterThan(0).and(Predicates.lessThan(11)));
   Verify.assertStartsWith(list, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6);
 }
 @Override
 @Test
 public void forEachWithIndex() {
   super.forEachWithIndex();
   MutableList<Integer> list = FastList.newList();
   CompositeFastList<Integer> iterables = new CompositeFastList<Integer>();
   iterables.addComposited(Interval.fromTo(6, 10).toList());
   iterables.addComposited(Interval.oneTo(5).toList());
   iterables.forEachWithIndex((each, index) -> list.add(index, each));
   Verify.assertSize(10, list);
   Verify.assertAllSatisfy(list, Predicates.greaterThan(0).and(Predicates.lessThan(11)));
   Verify.assertStartsWith(list, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5);
 }
 private void basicCollectIf(RichIterable<Integer> collection) {
   Predicate<Integer> greaterThan = Predicates.greaterThan(10000);
   Collection<String> actual1 =
       ParallelIterate.collectIf(collection, greaterThan, String::valueOf);
   Collection<String> actual2 =
       ParallelIterate.collectIf(
           collection,
           greaterThan,
           String::valueOf,
           HashBag.<String>newBag(),
           3,
           this.executor,
           true);
   Collection<String> actual3 =
       ParallelIterate.collectIf(
           collection,
           greaterThan,
           String::valueOf,
           HashBag.<String>newBag(),
           3,
           this.executor,
           true);
   Bag<String> expected = collection.collectIf(greaterThan, String::valueOf).toBag();
   Verify.assertSize(10000, actual1);
   Verify.assertNotContains(String.valueOf(9000), actual1);
   Verify.assertNotContains(String.valueOf(21000), actual1);
   Verify.assertContains(String.valueOf(15976), actual1);
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual1.getClass().getSimpleName(),
       expected,
       HashBag.newBag(actual1));
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual2.getClass().getSimpleName(),
       expected,
       actual2);
   Assert.assertEquals(
       expected.getClass().getSimpleName() + '/' + actual3.getClass().getSimpleName(),
       expected,
       actual3);
 }
 @Test
 @Override
 public void reject() {
   ImmutableBag<String> strings = this.newBag();
   Verify.assertIterableEmpty(strings.reject(Predicates.greaterThan("0")));
 }
 @Test
 public void reject() {
   ImmutableCollection<Integer> integers = this.classUnderTest();
   Verify.assertIterableEmpty(integers.reject(Predicates.lessThan(integers.size() + 1)));
   Assert.assertEquals(integers, integers.reject(Predicates.greaterThan(integers.size())));
 }
 @Test
 public void noneSatisfyOver100() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.oneTo(101));
   Assert.assertFalse(ArrayListIterate.noneSatisfy(list, Predicates.instanceOf(Integer.class)));
   Assert.assertTrue(ArrayListIterate.noneSatisfy(list, Predicates.greaterThan(150)));
 }
 @Test
 public void allSatisfy() {
   ArrayList<Integer> list = this.getIntegerList();
   Assert.assertTrue(ArrayListIterate.allSatisfy(list, Predicates.instanceOf(Integer.class)));
   Assert.assertFalse(ArrayListIterate.allSatisfy(list, Predicates.greaterThan(2)));
 }