/// <summary> /// Create a new indexed sorted collection consisting of the items of this /// indexed sorted collection satisfying a certain predicate. /// </summary> /// <param name="f">The filter delegate defining the predicate.</param> /// <returns>The new indexed sorted collection.</returns> public IIndexedSorted<T> FindAll(Func<T, bool> f) { SortedArray<T> res = new SortedArray<T>(_comparer); int j = 0, rescap = res.array.Length; for (int i = 0; i < size; i++) { T a = array[i]; if (f(a)) { if (j == rescap) res.expand(rescap = 2 * rescap, j); res.array[j++] = a; } } res.size = j; return res; }