Here you can find the source of sortInsert(Vector v, Object obj)
public static void sortInsert(Vector v, Object obj)
//package com.java2s; import java.util.*; public class Main { public static void sortInsert(Vector v, Object obj) { 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; }//w w w . j av a 2 s . c om } v.addElement(obj); } }