Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vector-search through /display only one instance

Status
Not open for further replies.

overflo

Technical User
Feb 10, 2003
70
AU
I have a Vector (onLoanList) that holds ResourceID's and BorrowerID's. The ResourceID's are unique but it can have multiple instances of the BorrowerID's.
I need to iterate through the list and grab the BorrowerID's, that bit's easy, but then I need to display them (still easy) but when there are multiple instances I need it to display only once.
When I get that sorted I also need to count through so that the borrower ID is recorded only up to 4 times
Any help greatly appreciated
 
You would better override the equals method of your object. In your public boolean equals(Object) method, control if both resourceIds are same or not.

If they are same don't display it.Use this equals method in your iteration of course.

You can have more idea about equals method by searhing java.lang.Object class and its methods.

Salih Sipahi
Software Engineer.
City of Istanbul Turkey
s.sipahi@sahinlerholding.com.tr
turkey_clr.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top