Array.partitionSegmentIntoSegments - Handle empty segments properly