FileDocCategorySizeDatePackage
StrSort.javaAPI DocExample834Sat Nov 25 12:56:22 GMT 2000None

StrSort

public class StrSort extends Object
StrSort demonstrates sorting of strings using Collections.sort.

Fields Summary
public static String[]
rawStrings
The list of strings to be sorted
Vector
v
Constructors Summary
Methods Summary
voiddump(java.lang.String title)

		System.out.println("***** " + title + " *****");
		for (int i=0; i<v.size(); i++)
			System.out.println("v["+i+"]="+v.elementAt(i));
	
voidload()


	  
		v = new Vector();
		for (int i=0; i<rawStrings.length; i++)
			v.addElement(rawStrings[i]);
	
public static voidmain(java.lang.String[] argv)
Simple main program to test the sorting

		System.out.println("StrSort Demo in Java");
		StrSort s = new StrSort();
		s.load();
		s.dump("Before");
		Collections.sort(s.v);
		s.dump("After");