public static Boolean ForEach <T>(this List <Double> list, Cern.Colt.Function.DoubleProcedure procedure) { Double[] theElements = list.ToArray(); int theSize = list.Count; for (int i = 0; i < theSize;) { if (!procedure(theElements[i++])) { return(false); } } return(true); }
/// <summary> /// Applies a procedure to each element of the receiver, if any. /// Iterates over the receiver in no particular order. /// </summary> /// <param name="procedure">the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. </param> /// <returns></returns> public Boolean ForEach(Cern.Colt.Function.DoubleProcedure procedure) { for (int i = buffers.Length; --i >= 0;) { for (int w = buffers[i].Weight; --w >= 0;) { if (!(buffers[i].Values.ForEach(procedure))) { return(false); } } } return(true); }