optimization for IndexBuilder

keep track of the orderedness of the keys that have been added, and return an `OrderedIndex` when result() is called and isOrdered is still true