Results 1 to 12 of 12
Thread: Vector<vector> loop thru
- 11-20-2009, 04:10 PM #1
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Vector<vector> loop thru
SOLVED
Evening, new problem that makes my hair grey, if i have a
And i loop it thru with.Java Code:Vector<vector> rowDataIn = new Vector<vector> rowDataIn.add(1); rowDataIn.add(2);
It just loop thru the first one. Leaving the Object done with the result [1, 2] and not 1 2 as i would like. How can this be solved?Java Code:Iterator iterator = rowDataIn.iterator(); while (iterator.hasNext()){ done = iterator.next(); }Last edited by ocean; 11-21-2009 at 11:44 AM.
- 11-20-2009, 08:01 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,396
- Blog Entries
- 7
- Rep Power
- 17
What is your 'vector' class? (lowercase 'v')
kind regards,
Jos
- 11-20-2009, 08:21 PM #3
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Sorry just a misspell when i posted, it should be Vector<Vector> rowDataIn = new Vector<Vector>
- 11-20-2009, 08:26 PM #4
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Do you understand what my problem is? my bad English makes it hard for me to explain.
- 11-21-2009, 08:45 AM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,396
- Blog Entries
- 7
- Rep Power
- 17
- 11-21-2009, 09:06 AM #6
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Im sending the data to a file, and i want the format data,data,data. And not [data,data,data]. I need someway too loop the Object done.
if i write out the vector before any loop it looks like --> [[data,data,data]]
I Use Iterator and after the loop it looks like this --> [data,data,data]
I Need another loop so it looks like this --> data,data,data
My problem is that after the first loop my Vector has turned into an Object and i cant use Iterator on it.Last edited by ocean; 11-21-2009 at 09:09 AM.
- 11-21-2009, 10:36 AM #7
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
I realise now that i have posted wrong. It should be as follow.
Now itś correct, how do i loop thrue the v Vector so the result will beJava Code:Vector<Vector> v = new Vector<Vector> Vector<String> s = new Vector<String> s.addElement("One"); s.addElement("Two"); s.addElement("Three"); v.add(s);
One Two Three.
And not [One,Two,Three]
- 11-21-2009, 11:43 AM #8
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Solved it! Thanks anyway.
- 11-21-2009, 11:54 AM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,396
- Blog Entries
- 7
- Rep Power
- 17
- 11-21-2009, 01:13 PM #10
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
What i have in mind is to save the userinput from JTable into a file as data;data;data. wich it now does. But as I solved 1 problem next is just arund the corner.
It saves it all in one row. Somehow i need to count columns and add a \n at the end.
Anyone has experience at saving from JTable to File, And Read it back from File to JTable? And that mabey could give me some advice ow this is best done.
-
Hm, serialize the data might be an option. Have you gone through the Serialization tutorial at the Sun tutorials?
- 11-21-2009, 02:17 PM #12
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Similar Threads
-
Vector
By sanox in forum New To JavaReplies: 20Last Post: 09-01-2009, 04:21 PM -
Vector
By MuslimCoder in forum Advanced JavaReplies: 4Last Post: 08-06-2009, 03:44 PM -
Vector<Point2D> list = new Vector<Point2D>();Is it possible for 15,000 Point2D obj???
By Mazharul in forum Java 2DReplies: 1Last Post: 04-06-2009, 06:45 AM -
vector - get
By natdizzle in forum New To JavaReplies: 2Last Post: 01-02-2009, 04:09 AM -
Vector help
By king_arthur in forum New To JavaReplies: 3Last Post: 01-22-2008, 07:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks