Java Utililty Methods Vector Sort

List of utility methods to do Vector Sort

Description

The list of methods to do Vector Sort are organized into topic(s).

Method

Vectorsort(Vector unsorted, int sortKeyPos, int maxVal)
Sorts the elements of a Vector.
int listSize = unsorted.size();
Vector sorted = (Vector) unsorted.clone();
int[] map = new int[maxVal];
int index = -1;
for (int i = 0; i < listSize; i++) {
    index = ((Integer) (((Object[]) unsorted.elementAt(i))[sortKeyPos])).intValue();
    if (index > maxVal)
        throw new IllegalArgumentException("Incorrect maxVal");
...
voidsortInsert(Vector v, Object obj)
sort Insert
Enumeration e = v.elements();
for (int i = 0; i < v.size(); i++) {
    Object cur = v.elementAt(i);
    if (obj.toString().compareTo(cur.toString()) < 0) {
        v.insertElementAt(obj, i);
        return;
v.addElement(obj);
VectorsortIntegerVector(Vector toSort)
Sorts an vector.
if (toSort == null) {
    return new Vector();
int size = toSort.size();
if (size == 0) {
    return toSort;
Vector sorted = new Vector();
...