Link to home
Start Free TrialLog in
Avatar of javaQQ
javaQQ

asked on

Accessing a vector of vectors of vectors.

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.

SOLUTION
Avatar of travd
travd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of javaQQ
javaQQ

ASKER

Thanks for the solutions.
I will split the points between the two respondents.
Again many thanks.