Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10536

Re: Collection to implement linked structure traverse up and down

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Collection to implement linked structure traverse up and down
Date 2011-12-05 15:08 -0800
Organization http://groups.google.com
Message-ID <9648596.204.1323126509665.JavaMail.geo-discussion-forums@pruu5> (permalink)
References <68dffbe9-ba9e-4daa-9bab-deac913b2cfe@t38g2000prg.googlegroups.com> <ViKAq.67226$yY3.16931@newsfe01.iad> <4ed79fbb$0$9866$9a6e19ea@unlimited.newshosting.com> <8ed0597d-fb8b-4443-9a0f-798819cdcf5e@s4g2000yqk.googlegroups.com>

Show all headers | View raw


ruds wrote:
> Roedy Green: Can you elaborate some more on "a HashMap an ArrayList
> and a TreeSet simultaneously all on the same group of objects."

Consider this fragment:

 Map<Foo, Bar> bars = new HashMap<>();
 List<Bar> barVals = new ArrayList<>();
 Set<Foo> foos = new TreeSet<>();
...
 Foo foo = new Foo();
 Bar bar = new Bar();
 bars.put(foo, bar);
 barVals.add(bar);
 foos.add(foo);
...

A pointer to the same 'foo' appears in 'bars' and in 'foos'.  A pointer to the same 'bar' appears in 'bars' and in 'barVals'.

Do that again with a new 'foo' and a new 'bar' a few times and you have "a group of objects" in all three collections simultaneously.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-11-27 23:53 -0800
  Re: Collection to implement linked structure traverse up and down Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-28 07:32 -0400
    Re: Collection to implement linked structure traverse up and down Wayne <nospam@all.invalid> - 2011-12-01 10:39 -0500
      Re: Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-12-04 23:57 -0800
        Re: Collection to implement linked structure traverse up and down Lew <lewbloch@gmail.com> - 2011-12-05 15:08 -0800
          Re: Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-12-05 21:55 -0800
  Re: Collection to implement linked structure traverse up and down Roedy Green <see_website@mindprod.com.invalid> - 2011-11-29 17:01 -0800
    Re: Collection to implement linked structure traverse up and down Henk van Voorthuijsen <voorth@xs4all.nl> - 2011-12-05 02:41 -0800
  Re: Collection to implement linked structure traverse up and down Martin Gregorie <martin@address-in-sig.invalid> - 2011-11-30 21:17 +0000

csiph-web