Adds sorting to collections.

list and sequence now have sortBy, sort, copySorted, etc.
This mean chnaging the method on primitiveArray to
allow the length to be specified.  Adds tests, too.