StringSorter.sort

Overview | Methods | Fields | This Package | All Packages

StringSorter.sort

Sorts the elements in an object array.

Syntax

public static void sort( Object[] items )

public static void sort( Object[] items, int index, int count )

public static void sort( String[] keys, Object[] items )

public static void sort( String[] keys, Object[] items, int index, int count )

public static void sort( Object[] items, int options )

public static void sort( Object[] items, int index, int count, int options )

public static void sort( String[] keys, Object[] items, int options )

public static void sort( String[] keys, Object[] items, int index, int count, int options )

public static void sort( Locale locale, Object[] items, int options )

public static void sort( Locale locale, Object[] items, int index, int count, int options )

public static void sort( Locale locale, String[] keys, Object[] items, int options )

public static void sort( Locale locale, String[] keys, Object[] items, int index, int count, int options )

Parameters

items

The object array to sort.

index

The zero-based index at which to begin sorting.

count

The number of elements to sort.

keys

The keys to sort by. If null, the sort key for an element is produced by calling the toString method.

locale

A Locale object that specifies the locale to use. If no value is specified or if null is passed, the current locale is used.

options

The sorting options. You can specify any bitwise combination of the StringSorter fields.

Remarks

This method sorts the array based on the string representation of the elements. If the items array is not a string array, the toString method of each of the elements is called to produce the string representation.

This method also sorts the object array based on the string array. Elements in the keys array specify the sort keys for corresponding elements in the items array.  The range of elements given by the index and count parameters is sorted in both arrays according to the specified locale and sorting options.

If the keys parameter is null, the sort keys are instead computed by calling the toString method of each element in the items array. The null keys always sort before non-null keys.