Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Reverse lookup and removal of object in a vector.  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This might be an easy problem for someone but I can't see to get it down:
What I have is a vector which contains objects that are a bean class I created.
What I need to do is go thru this vector in reverse order - and remove from the bottom up the beans from the vector until I hit a bean which contains an int that is equal to another int that my program knows about. Then I have to remove that bean - but then I want to stop - I don't want to remove any beans above that in the vector. Of course, my bean has some method like getMyInt() that I will use.
Does anyone follow this? I don't think it is hard - I am just stuck on it.
Many Thanks!
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the following code might help you... I'm not sure whether it is the goal that u want... :roll:
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!