Sorting an array of Strings : Sort Search : Collections Data Structure : Java examples (example source code) Organized by topic

Java
C++
PHP


Java  »  Collections Data Structure   » [  Sort Search  ]  Screenshots 
 



Sorting an array of Strings



// : c11:StringSorting.java
// Sorting an array of Strings.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

import java.util.Arrays;

public class StringSorting {
  public static void main(String[] args) {
    String[] sa = new String[] { "d""e""a""c""g" };

    System.out.println("Before sorting: " + Arrays.asList(sa));
    Arrays.sort(sa);
    System.out.println("After sorting: " + Arrays.asList(sa));
  }
///:~



           
       
Related examples in the same category
1.  Simple Sort Demo Simple Sort Demo
2.  A simple applet class to demonstrate a sort algorithm
3.  Simple version of quick sort Simple version of quick sort
4.  Combine Quick Sort Insertion Sort Combine Quick Sort Insertion Sort
5.  Quick sort with median-of-three partitioning Quick sort with median-of-three partitioning
6.  Selection sort Selection sort
7.  Insert Sort for objects Insert Sort for objects
8.  Insert sort Insert sort
9.  Bubble sort Bubble sort
10.  Merge sort Merge sort
11.  Binary Search Binary Search
12.  Shell sort Shell sort
13.  Topological sorting Topological sorting
14.  Heap sort Heap sort
15.  Sort Numbers Sort Numbers
16.  A quick sort demonstration algorithm A quick sort demonstration algorithm
17.  Customized Sort Test
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.