JIU 0.12.0 Homepage

net.sourceforge.jiu.util
Class Sort

java.lang.Object
  extended bynet.sourceforge.jiu.util.Sort

public class Sort
extends Object

Provides sorting of an Object array.

Author:
Marco Schmidt

Method Summary
static void sort(Object[] a, ComparatorInterface comparator)
          Sort the complete argument array according to the argument comparator.
static void sort(Object[] a, int from, int to, ComparatorInterface c)
          Sorts some (or all) elements of an Object array according to a specified comparator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sort

public static void sort(Object[] a,
                        int from,
                        int to,
                        ComparatorInterface c)
Sorts some (or all) elements of an Object array according to a specified comparator. This method does exactly the same as java.util.Arrays.sort(Object[], int, int, Comparator). Unfortunately, this method is not available in Java 1.1, so it must be provided here.

As for the implementation of this method, it is taken from Arrays.java as found in Classpath 0.0.2 (2001-01-06). Go to www.classpath.org to learn more about the project, which implements the Java core libraries under the GPL.

Parameters:
a - the array which is to be sorted
from - the index value of the first element of the interval to be sorted
to - the index value of the last element of the interval to be sorted
c - the comparator used to query the relation between two objects

sort

public static void sort(Object[] a,
                        ComparatorInterface comparator)
Sort the complete argument array according to the argument comparator. Simply calls sort(a, 0, a.length - 1, comparator);

Parameters:
a - array to be sorted
comparator - the comparator used to compare to array entries

JIU 0.12.0 Homepage

Copyright © 2000, 2001, 2002, 2003, 2004 Marco Schmidt