addAllIf method

void addAllIf(
  1. ConditionTester<T> condition,
  2. Iterable<T> items
)

Adds all items from another list to a list if a condition is met.

Parameters

  • condition: The condition to check
  • items: The items to add

Implementation

void addAllIf(ConditionTester<T> condition, Iterable<T> items) {
  if(all(condition)) {
    addAll(items);
  }
}