Java Utililty Methods Array Sort

List of utility methods to do Array Sort

Description

The list of methods to do Array Sort are organized into topic(s).

Method

String[]sortStringArray(String[] array)
sort String Array
if ((array == null) || (array.length < 0))
    return new String[0];
Arrays.sort(array);
return array;
String[]sortStringArray(String[] array)
sort String Array
if (isEmpty(array)) {
    return new String[0];
Arrays.sort(array);
return array;
String[]sortStringArray(String[] source)
String sort method.
if (source == null) {
    return new String[0];
Arrays.sort(source);
return source;
voidsortStringArrayAlphabetically(String[] strings)
sort String Array Alphabetically
int j;
boolean notDone = true; 
String temp;
while (notDone) {
    notDone = false;
    for (j = 0; j < strings.length - 1; j++) {
        if (strings[j].compareToIgnoreCase(strings[j + 1]) > 0) { 
            temp = strings[j];
...
voidsortStrings(final String[] strings)
Quick sort an array of Strings.
sortStrings(strings, 0, strings.length - 1);
voidsortStrings(String[] strings)
Quick sort an array of Strings.
Arrays.sort(strings);
voidsortStrings(String[] strings)
Quick sort an array of Strings.
Arrays.sort(strings);
voidsortStrings(String[] strings)
sort Strings
for (int i = 0; i < strings.length - 1; ++i) {
    for (int j = i + 1; j < strings.length; ++j) {
        if (strings[i].compareTo(strings[j]) > 0) {
            String t = strings[i];
            strings[i] = strings[j];
            strings[j] = t;
String[]sortSubFiles(String[] p_subFiles)
Sort the separated file by the suffix number in the filename
if (p_subFiles == null || p_subFiles.length == 0)
    return p_subFiles;
int length = p_subFiles.length;
String[] sortedSubFiles = new String[length];
String tmp = "";
int index = -1;
for (int i = 0; i < length; i++) {
    tmp = p_subFiles[i];
...
String[][]sortTable(String[][] data, int index)
sort Table
Map<String, String[]> map = new HashMap<String, String[]>();
List<String> listKeys = new ArrayList<String>();
for (int i = 0; i < data.length; i++) {
    String[] row = data[i];
    String key = row[index];
    map.put(key, row);
    listKeys.add(key);
Collections.sort(listKeys);
String[][] result = new String[listKeys.size()][];
for (int i = 0; i < listKeys.size(); i++) {
    String key = listKeys.get(i);
    result[i] = map.get(key);
return result;