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;
}
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());
}
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;
}
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();
}
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;
}
Aggregations