This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I search after a number in a vector element ?

 
Fredrik Komstadius
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I have a problem that I desperately need solved.
How do I search a vetor which contains of 30 elements ? I want to search each element after one or more numbers.. how do I do that ? I have tried lot's things but I can't seem to get it to work..
Help would be very appreciated
/Bossakungen
 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To search a vector for a particular object use its indexOf(Object element) method. If it finds the element, it return its index; else it will return -1.
HTH,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic