FileDocCategorySizeDatePackage
StrSortCase.javaAPI DocExample914Sat Nov 25 12:56:24 GMT 2000None

StrSortCase

public class StrSortCase extends Object
StrSortCase demonstrates sorting of strings using Collections.sort AND ignoring case.

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 Ignoring Case");
		StrSortCase s = new StrSortCase();
		s.load();
		s.dump("Before");
		Collections.sort(s.v, String.CASE_INSENSITIVE_ORDER);
		s.dump("After");