code: void insert_in_list(final WorkItem new_work) {
  	int i;
  	boolean done = false;
  	for (i = 0; i < works.size() && !done; i++) {
  	    final WorkItem item = (WorkItem) works.elementAt(i);
  	    if (item.wake_up_date.tv_sec < new_work.wake_up_date.tv_sec) {
  		continue;
  	    } else if (item.wake_up_date.tv_sec == new_work.wake_up_date.tv_sec) {
  		if (item.wake_up_date.tv_usec < new_work.wake_up_date.tv_usec) {
  		    continue;
  		} else {
  		    works.insertElementAt(new_work, i);
  		    done = true;
  		}
  	    } else {
  		works.insertElementAt(new_work, i);
  		done = true;
  	    }
  	}
  	if (i == works.size()) {
  	    works.add(new_work);
  	}
      }
docs: ===============================================================