SharpNeat.Core.CoordinateVector.IsSorted C# (CSharp) Method

IsSorted() private static method

private static IsSorted ( double>.KeyValuePair coordElemArray ) : bool
coordElemArray double>.KeyValuePair
return bool
        private static bool IsSorted(KeyValuePair<ulong,double>[] coordElemArray)
        {
            if(0 == coordElemArray.Length) {
                return true;
            }

            ulong prevId = coordElemArray[0].Key;
            for(int i=1; i<coordElemArray.Length; i++)
            {   // <= also checks for duplicates as well as sort order.
                if(coordElemArray[i].Key <= prevId) {
                    return false;
                }
            }
            return true;
        }