File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes What are the advantages when we do like this? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What are the advantages when we do like this?" Watch "What are the advantages when we do like this?" New topic
Author

What are the advantages when we do like this?

bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3099
    
  33

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What are the advantages when we do like this?