@ Override @ SuppressWarnings ( "unchecked" ) public < E > E [ ] sort ( final E ... elements ) { return ( E [ ] ) sort ( new SortableArrayList ( elements ) ) . toArray ( ( E [ ] ) Array . newInstance ( elements . getClass ( ) . getComponentType ( ) , elements . length ) ) ; }
Uses the Merge Sort to sort an array of elements as defined by the Comparator or as determined by the elements in the array if the elements are Comparable .