public class ArraySorter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ArraySorter.ASCIIComparer
Compares assuming the String is only ASCII.
|
static interface |
ArraySorter.Comparer
The interface implementation should compare the two objects and return an
int using these rules: if (a > b) return > 0; if (a == b) return 0; if (a
< b) return < 0;
For example to sort a String array: ClassName implements
ArraySorter.Comparer
public int compare(Object a, Object b) { return (the proper int); }
|
| Modifier and Type | Field and Description |
|---|---|
static ArraySorter.ASCIIComparer |
asciiComparer |
| Constructor and Description |
|---|
ArraySorter() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
Performs a simple unit test by sorting command arguments.
|
static void |
sort(java.lang.Object[] a,
ArraySorter.Comparer comparer)
Sorts the array in ascending order using the Comparer.
|
static void |
sort(java.lang.Object[] a,
java.lang.Object[] b,
int from,
int to,
boolean ascending,
ArraySorter.Comparer comparer)
Sorts both arrays.
|
static void |
sortASCII(java.lang.String[] a)
Sorts an ASCII String array in ascending order.
|
public static final ArraySorter.ASCIIComparer asciiComparer
public static void main(java.lang.String[] args)
public static void sortASCII(java.lang.String[] a)
public static void sort(java.lang.Object[] a,
ArraySorter.Comparer comparer)
public static void sort(java.lang.Object[] a,
java.lang.Object[] b,
int from,
int to,
boolean ascending,
ArraySorter.Comparer comparer)