Search in sources :

Example 21 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class ObjectBooleanHashMapValuesTestCase method booleanIterator.

@Override
@Test
public void booleanIterator() {
    MutableBooleanCollection bag = this.newWith(true, false, true, true);
    BooleanArrayList list = BooleanArrayList.newListWith(true, false, true, true);
    BooleanIterator iterator1 = bag.booleanIterator();
    for (int i = 0; i < 4; i++) {
        Assert.assertTrue(iterator1.hasNext());
        Assert.assertTrue(list.remove(iterator1.next()));
    }
    Verify.assertEmpty(list);
    Assert.assertFalse(iterator1.hasNext());
    Verify.assertThrows(NoSuchElementException.class, (Runnable) iterator1::next);
    ObjectBooleanHashMap<String> map2 = new ObjectBooleanHashMap<>();
    for (int each = 2; each < 100; each++) {
        map2.put(String.valueOf(each), each % 2 == 0);
    }
    MutableBooleanIterator iterator2 = map2.booleanIterator();
    while (iterator2.hasNext()) {
        iterator2.next();
        iterator2.remove();
    }
    Assert.assertTrue(map2.isEmpty());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) BooleanIterator(org.eclipse.collections.api.iterator.BooleanIterator) MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 22 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project narchy by automenta.

the class EngineRunner method initialize.

/**
 * Config this Manager
 */
EngineRunner initialize(Prolog vm) {
    mediator = vm;
    theories = vm.theories;
    primitives = vm.prims;
    libraryManager = vm.libs;
    engineManager = vm.engine;
    detached = false;
    solving = false;
    sinfo = null;
    msgs = new TermQueue();
    next = new BooleanArrayList();
    countNext = 0;
    lockVar = new ReentrantLock();
    cond = lockVar.newCondition();
    return this;
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Example 23 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class OrderedMapAdapter method collectBoolean.

@Override
public MutableBooleanList collectBoolean(BooleanFunction<? super V> booleanFunction) {
    BooleanArrayList result = new BooleanArrayList(this.size());
    this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
    return result;
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Example 24 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class AbstractImmutableSortedMap method collectBoolean.

@Override
public ImmutableBooleanList collectBoolean(BooleanFunction<? super V> booleanFunction) {
    BooleanArrayList result = new BooleanArrayList(this.size());
    this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
    return result.toImmutable();
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Example 25 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class AbstractImmutableSortedSet method collectBoolean.

@Override
public ImmutableBooleanList collectBoolean(BooleanFunction<? super T> booleanFunction) {
    BooleanArrayList result = new BooleanArrayList(this.size());
    this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
    return result.toImmutable();
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Aggregations

BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)49 Test (org.junit.Test)35 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)11 BooleanIterable (org.eclipse.collections.api.BooleanIterable)7 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)6 MutableBooleanSet (org.eclipse.collections.api.set.primitive.MutableBooleanSet)3 BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)3 ByteArrayList (org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList)3 CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)3 DoubleArrayList (org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList)3 FloatArrayList (org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList)3 IntArrayList (org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)3 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)3 ShortArrayList (org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 NoSuchElementException (java.util.NoSuchElementException)2 ImmutableSortedBag (org.eclipse.collections.api.bag.sorted.ImmutableSortedBag)2 MutableCollection (org.eclipse.collections.api.collection.MutableCollection)2