Results 1 to 4 of 4
Thread: Vector help
- 01-22-2008, 12:28 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 3
- Rep Power
- 0
Vector help
hi guys!
i'm new to Java so i have a little problem... hope you could help me :)
i've read names from a file into vector and sorted them so i have like this in vector now
Darko
Ivan
Ivan
Mario
Mario
Mario
Mario
Martin
Martin
Martin
Pero
Pero
how can i count which name is most repeated?
in this case it would be Mario 5... i just need a number
thx a lot.
hope you understand everything 'cause my english is not very good :)
- 01-22-2008, 08:15 PM #2
Welcome to the Java Forums!
Have a looksee at the API regarding Vectors, if you haven't already... you can probably use one or a combination of the methods available for your task. Post you attempted code when you get stuck.
Worse case scenario, you could probably iterate through the list of elements while comparing each element and using a counter at the same time.
See you around!Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
- 01-22-2008, 08:24 PM #3
Member
- Join Date
- Jan 2008
- Posts
- 3
- Rep Power
- 0
ok!
thx,i solve the problem...
i used if(vector.get(i)!=vector.get(i+1)) instead of if(!vector.get(i).equals(vector.get(i+1)) and that was problem...
later i tried with if(!vector.get(i).equals(vector.get(i+1)) and it worked fine...
but thx for help!
see you around! :)
- 01-22-2008, 08:33 PM #4
Great to see that you solved your problem.
Cheers :)Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
Similar Threads
-
Vector create
By Warren in forum New To JavaReplies: 4Last Post: 03-02-2010, 03:42 AM -
Array or Vector
By ravian in forum New To JavaReplies: 2Last Post: 11-18-2007, 07:19 PM -
vector problem
By mambo_jumbo in forum New To JavaReplies: 1Last Post: 11-17-2007, 11:44 PM -
using Iterator with Vector
By Java Tip in forum Java TipReplies: 0Last Post: 11-13-2007, 11:52 AM
Bookmarks