public void Clear(ParameterCallable <T> pParameterCallable) { for (int i = this.Count - 1; i >= 0; i--) { T removed = this[i]; this.Remove(removed); pParameterCallable.call(removed); } }
// =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== /** * @param pItem the item to remove. * @param pParameterCallable to be called with the removed item, if it was removed. */ public bool Remove(T pItem, ParameterCallable <T> pParameterCallable) { bool removed = this.Remove(pItem); if (removed) { pParameterCallable.call(pItem); } return(removed); }
/** * @param pMatcher to find the items. * @param pParameterCallable to be called with each matched item after it was removed. */ public bool RemoveAll(IMatcher <T> pMatcher, ParameterCallable <T> pParameterCallable) { bool result = false; for (int i = this.Count - 1; i >= 0; i--) { if (pMatcher.Matches(this[i])) { T removed = this[i]; this.Remove(removed); pParameterCallable.call(removed); result = true; } } return(result); }