tags:

views:

186

answers:

4

If you had an array of Strings, what is the quickest way to sort this array in ascending order ?

+8  A: 

See java.util.Arrays.sort(Object[])

import java.util.*;
Arrays.sort(stringarray)
lavinio
+2  A: 

Arrays.sort() for now.

Also I heard that Josh Bloch is working on a much faster sort algorithm than the current mergesort. (I can't remember where, maybe in this interview. The new algorithm will perform better for partially sorted arrays and originates from a Python? sort implementation). Also see this question.

kd304
+2  A: 
String[] Mystring = {"cat","lion", "dog", "mouse"};
Arrays.sort(Mystring);

Sorting Arrays

TStamper