Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2008, 12:28 PM
Member
 
Join Date: Jan 2008
Posts: 3
king_arthur is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-22-2008, 08:15 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 839
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
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!
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-22-2008, 08:24 PM
Member
 
Join Date: Jan 2008
Posts: 3
king_arthur is on a distinguished road
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!
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-22-2008, 08:33 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 839
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Great to see that you solved your problem.

Cheers
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vector Capacity JavaForums Java Blogs 0 12-03-2007 01:10 AM
Vector create Warren New To Java 3 11-19-2007 09:13 PM
Array or Vector ravian New To Java 2 11-18-2007 07:19 PM
vector problem mambo_jumbo New To Java 1 11-17-2007 11:44 PM
using Iterator with Vector Java Tip Java Tips 0 11-13-2007 11:52 AM


All times are GMT +3. The time now is 10:36 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org