luck, db
There are no new questions, but there may be new answers.
Haani Naz wrote:i'm working on a library lending system..
the logic i'm using is:
1. get name of person you would like to lend the book to
2. if arraylist is empty, add person/set name
3. loop through person arraylist
3.1 compare person name
3.1.1 if person name matches then lend book
3.1.2 if person name doesn't match add person to arraylist
[go back to step 3]
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Seems reasonable, and I think Annirudh has probably covered your error.
However, the underlying issue is that an ArrayList is not really a great collection for this type of logic; a HashMap would be much better, viz:
Winston
Anniruddh Rana wrote:I believe you meant a HashSet as mentioned by Darryl (HashMap.put takes a key value pair as arguments)...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Haani Naz wrote:ok just read Anniruddh Rana's post again.
think its slowly gelling together now, i realize that i need to override the equals method.
will give that a go!