Search in sources :

Example 41 with BooleanArrayList

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

the class SortedSetAdapter method collectBoolean.

@Override
public MutableBooleanList collectBoolean(BooleanFunction<? super T> 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 42 with BooleanArrayList

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

the class ObjectBooleanHashMapValuesTestCase method retainAll_iterable.

@Override
@Test
public void retainAll_iterable() {
    Assert.assertFalse(this.newWith().retainAll(new BooleanArrayList()));
    ObjectBooleanHashMap<Integer> map = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection = map.values();
    Assert.assertFalse(collection.retainAll(BooleanArrayList.newListWith(false, true)));
    Assert.assertTrue(collection.retainAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(collection.contains(false));
    Assert.assertTrue(collection.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.contains(true));
    Assert.assertTrue(collection.retainAll(BooleanArrayList.newListWith(false)));
    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.retainAll(new BooleanArrayList()));
    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());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 43 with BooleanArrayList

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

the class ArrayListAdapter method collectBoolean.

@Override
public MutableBooleanList collectBoolean(BooleanFunction<? super T> booleanFunction) {
    BooleanArrayList result = new BooleanArrayList(this.size());
    this.each(each -> result.add(booleanFunction.booleanValueOf(each)));
    return result;
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Example 44 with BooleanArrayList

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

the class AbstractImmutableList 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)

Example 45 with BooleanArrayList

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

the class RandomAccessListAdapter method collectBoolean.

@Override
public MutableBooleanList collectBoolean(BooleanFunction<? super T> 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)

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