/// <inheritdoc /> /// <summary> /// Determines whether the specified value is contained. /// </summary> /// <param name="item">The value.</param> /// <returns> /// <c>true</c> if the specified value is contained; otherwise, <c>false</c>. /// </returns> public bool Contains(T item) { return(_wrapped.Where(Check).Any()); bool Check(T input) { return(Comparer.Equals(input, item)); } }
/// <summary> /// Removes the values where the predicate is satisfied. /// </summary> /// <param name="check">The predicate.</param> /// <returns> /// The number or removed values. /// </returns> /// <remarks> /// It is not guaranteed that all the values that satisfies the predicate will be removed. /// </remarks> public int RemoveWhere(Predicate <T> check) { if (check == null) { throw new ArgumentNullException(nameof(check)); } var matches = _bucket.Where(check); return(matches.Count(Remove)); }
/// <summary> /// Removes the values where the predicate is satisfied. /// </summary> /// <param name="check">The predicate.</param> /// <returns> /// The number or removed values. /// </returns> /// <remarks> /// It is not guaranteed that all the values that satisfies the predicate will be removed. /// </remarks> public int RemoveWhere(Predicate <T> check) { if (check == null) { throw new ArgumentNullException(nameof(check)); } var matches = _bucket.Where(check); var count = 0; foreach (var value in matches) { if (Remove(value)) { count++; } } return(count); }
public bool Contains(Predicate <T> itemCheck) { return(_wrapped.Where(itemCheck).Any()); }