TNamedValueArray::SortElementsIfRequired

Sorts the elements if they are not yet sorted.