Hello.

I would like to ask some suggestions to the community.

In Arrays, we can implement a 2D array like:

String[][] testString = new String[][] {
    {"1", "2", "6"},
    {"4", "5", "3"}
  };

How can I implement this in Vector? Or is that even possible?
I was doing it in Vector<Vector<>> manner but (obviously) it will not work. ^^;;

I want to include a code something like

...
if(variable.elementAt(i).elementAt(j).equals(something))

Sorry for the confusion.

That code works for me. Can you post the code that didn't work.

No so obviously. There's absolutely no reason why you can't have a Vector of Vectors. Just remember that you have to populate the outer Vector with new inner Vector(s).

Vector<Vector<String>> v = new Vector<Vector<String>>();
v.add(new Vector<String>());
v.elementAt(0).elementAt(0) ...

Yeah it works perfectly... This is allowed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.