Solved

# Accessing a vector of vectors of vectors.

Posted on 2003-12-11

If this post is a duplicate, MY APOLOGIES. I have not used this forum in months, and cannot find any trace of my earlier attempt to post this query.

I have two related questions regarding Vectors.

Question 1:

This code gives me the second value in the first element of a vector of vectors

((Vector)theVector.elementAt( 0 )).elementAt(1);

My question: How do I extend this for one more level (to a vector of vectors of vectors)?

For example, how do I get the the third value in the second vector of the first vector?

Question 2:

Code like the following

variableX = (String)((Vector)theVector.elementAt( 0 )).elementAt(3);

causes a "java.lang.ClassCastException" error:

apple.awt.EventQueueExceptionHandler Caught Throwable: java.lang.ClassCastException

Am I right in assuming that this is the reuslt of the code pointing to the wrong level of vector and

can be solved by the code which ppoints to the right level of vector?

Many thanks in advance.