This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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:
 
Screaming fools! It's nothing more than a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!