Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Sorting a Vector of Vectors

807603Aug 16 2006 — edited Nov 2 2007
I would like to sort a Vector of Vectors based on one element in the enclosed vectors.
Similar to sorting the rows of a JTable based on one column, but in this case there is no JTable.
		
		Vector one = new Vector();
			one.addElement( "al" );
			one.addElement( "plumber" );
			one.addElement( "25,000" );
		
		Vector two = new Vector();
			two.addElement( "bill" );
			two.addElement( "engineer" );
			two.addElement( "65,000" );
		
		Vector three = new Vector();
			three.addElement( "cathy" );
			three.addElement( "marketing" );
			three.addElement( "100,000" );

		
		Vector workers = new Vector();
			workers.addElement( "one" );
			workers.addElement( "two" );
			workers.addElement( "three" );
Is there any way to sort the "workers" vector based on the "name" vector?
i.e.: (Vector)workers.elementAt(x).elementAt(0);

Many thanks in advance

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 30 2007
Added on Aug 16 2006
5 comments
456 views