From: phuong nguyen (
Date: Sat Feb 03 2001 - 21:47:55 EET

Hi Group,

I have to modify the IteratorTest to show both ordered and unordered
traversals. Bellow is the part that will show the unordered. Can somebody
show me how to do the other part that means to make the numberList() and the
letterList() work in order not random.

// generate a random sized list of random numbers implemented as a vector

    public AbstractList numberList(){
              Random rand = new Random();
              Vector vector = new Vector();
                 for(int i = 0; i < (50 * rand.nextFloat()); i++) vector.add(new
                    return vector;

    // generate a list of letters implemented as a Vector
    public AbstractList letterList(){
              Random rand = new Random();
              String txt = text.getText();
              float length = (float)txt.length();
              Vector vector = new Vector();
              int index;

                 for(int i = 0; i < (50 * rand.nextFloat()); i++){
             do {
                         index = (int)(length * rand.nextFloat());
                 } while(!Character.isLetterOrDigit(txt.charAt(index)));
              return vector;

Thank you very much.

Phuong Nguyen.

TCSS342 University of Washington, Tacoma, Washington states

Get your FREE download of MSN Explorer at

For more information about the rp-ml, see

This archive was generated by hypermail 2.1.2 : Fri Jan 04 2002 - 09:56:47 EET