wood burning stoves*
The moose likes Beginning Java and the fly likes How do I search after a number in a vector element ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I search after a number in a vector element ?" Watch "How do I search after a number in a vector element ?" New topic
Author

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

Fredrik Komstadius
Greenhorn

Joined: Mar 29, 2002
Posts: 19
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

Joined: May 31, 2001
Posts: 280
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,


Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
 
Consider Paul's rocket mass heater.
 
subject: How do I search after a number in a vector element ?