简体   繁体   中英

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

如果您有一个字符串数组,以最快的顺序对该数组排序的最快方法是什么?

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

import java.util.*;
Arrays.sort(stringarray)

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.

String[] Mystring = {"cat","lion", "dog", "mouse"};
Arrays.sort(Mystring);

Sorting Arrays

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM