dotnet/corefx — pull request #207 by stephentoub (2014-12-08 00:43:00+00:00)
Title: Remove allocations in ImmutableArray.RemoveAll/ImmutableList.FindAll

ImmutableArray.RemoveAll and ImmutableList.FindAll both unconditionally allocate an object (a list or a builder) to store the results of iterating over the collection and running the supplied predicate. However, if the predicate never returns true, these objects aren't needed. This PR simply changes the allocation of that object to be lazy such that it's only allocated if needed, making both FindAll and RemoveAll allocation-free if no elements are found to match the predicate.