use of org.eclipse.collections.api.bag.primitive.BooleanBag in project eclipse-collections by eclipse.
the class BooleanHashBag method addAll.
@Override
public boolean addAll(BooleanIterable source) {
if (source.isEmpty()) {
return false;
}
if (source instanceof BooleanBag) {
BooleanBag otherBag = (BooleanBag) source;
otherBag.forEachWithOccurrences(this::addOccurrences);
} else {
BooleanIterator iterator = source.booleanIterator();
while (iterator.hasNext()) {
boolean each = iterator.next();
this.add(each);
}
}
return true;
}
use of org.eclipse.collections.api.bag.primitive.BooleanBag in project eclipse-collections by eclipse.
the class BooleanHashBag method removeAll.
@Override
public boolean removeAll(BooleanIterable source) {
if (source.isEmpty()) {
return false;
}
int oldSize = this.size();
if (source instanceof BooleanBag) {
BooleanBag otherBag = (BooleanBag) source;
otherBag.forEachWithOccurrences((each, occurrences) -> {
if (each) {
this.trueCount = 0;
} else {
this.falseCount = 0;
}
});
} else {
BooleanIterator iterator = source.booleanIterator();
while (iterator.hasNext()) {
boolean each = iterator.next();
if (each) {
this.trueCount = 0;
} else {
this.falseCount = 0;
}
}
}
return this.size() != oldSize;
}
Aggregations