Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: Collection to implement linked structure traverse up and down Date: Tue, 29 Nov 2011 17:01:33 -0800 Organization: Canadian Mind Products Lines: 39 Message-ID: References: <68dffbe9-ba9e-4daa-9bab-deac913b2cfe@t38g2000prg.googlegroups.com> Reply-To: Roedy Green NNTP-Posting-Host: Z2l1DcCELS0rATq8NqV4Sw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10344 On Sun, 27 Nov 2011 23:53:30 -0800 (PST), ruds wrote, quoted or indirectly quoted someone who said : >Please tell me am i on the right path? There are two kinds of links: 1. links which define which objects are in the Set and how to find them. 2. links that define interrelationships between the objects. I would expect things to become clearer if you expected of your Collection to handle type (1), and you handled type (2) yourself independent of the Collection. I might help to recall it is possible to have a HashMap an ArrayList and a TreeSet simultaneously all on the same group of objects. So in your case you can have a Map for finding things, and a completely independent set of links defining your directed graph (to use the mathematical name for such a generic structure). If it is truly a tree, don't forget about JTree. see http://mindprod.com/jgloss/treeset.html http://mindprod.com/jgloss/treemap.html http://mindprod.com/jgloss/jtree.html http://mindprod.com/jgloss/tree.html -- Roedy Green Canadian Mind Products http://mindprod.com For me, the appeal of computer programming is that even though I am quite a klutz, I can still produce something, in a sense perfect, because the computer gives me as many chances as I please to get it right.