If you had an array of Strings, what is the quickest way to sort this array in ascending order ?
views:
186answers:
4
+8
A:
See java.util.Arrays.sort(Object[])
import java.util.*;
Arrays.sort(stringarray)
lavinio
2009-06-23 20:42:10
+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
2009-06-23 20:42:13
+2
A:
String[] Mystring = {"cat","lion", "dog", "mouse"};
Arrays.sort(Mystring);
TStamper
2009-06-23 20:42:46