| Author |
What are the advantages when we do like this?
|
bilal haider
Ranch Hand
Joined: Feb 08, 2011
Posts: 47
|
|
|
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2925
|
|
Bilal, Welcome to JavaRanch
Please TellTheDetails - And what is that you want to do? Also any exceptions you have with the code?
|
Mohamed Sanaulla | My Blog
|
 |
bilal haider
Ranch Hand
Joined: Feb 08, 2011
Posts: 47
|
|
A is contating an object of b which is containing a hashset of A.
There is no error or exception ... I just want to know that what are the advantages of this kind of containment?
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
Let's say you have this:
Can you see now what it is used for?
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
bilal haider
Ranch Hand
Joined: Feb 08, 2011
Posts: 47
|
|
Thank you very much for the quick response, and moving me one step ahead.
What I understand is that Group class is containing distinct child objects.
But why we are containing group object in child object?
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Its is so you can see an association from both sides. From the Group instance you know what Child object the Group contains. From the Child object, you know what Group this particular Child object belongs to.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
 |
|
|
subject: What are the advantages when we do like this?
|
|
|