Пример #1
0
 private int detectNotIndex(Predicate<? super T> predicate) {
   for (int index = 0; index < this.size(); index++) {
     if (!predicate.accept(this.items[index])) {
       return index;
     }
   }
   return this.size();
 }
Пример #2
0
 @Override
 public void removeIf(Predicate<? super T> predicate) {
   Set<Map.Entry<T, Counter>> entries = this.items.entrySet();
   for (Iterator<Map.Entry<T, Counter>> iterator = entries.iterator(); iterator.hasNext(); ) {
     Map.Entry<T, Counter> entry = iterator.next();
     if (predicate.accept(entry.getKey())) {
       iterator.remove();
       this.size -= entry.getValue().getCount();
     }
   }
 }