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


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

how do I merg two collections?

Newsgroups comp.lang.java.programmer
Date 2015-01-04 22:55 -0800
Message-ID <e429296f-b008-4a89-82e5-759d26d97edd@googlegroups.com> (permalink)
Subject how do I merg two collections?
From Brian O'Brien <brian.obrien@calgaryscientific.com>

Show all headers | View raw


I have two collections and I want to create a third Collection that is the union of the two collecions.

//psuedo code
Collection<String> a = "1","a", "2", "b";
Collection<String> b = "3", "a, "4", "b";
Collection<String> c = a + b;
// would produce..
"1", "a" , "2", "b", "3", "4"

Is there a collection method that does this?

Or must I iterate through the one of the sets and add to the other if it does not 'contain' the object?

TIA
B.



-- 

------------------------------
If you believe you have received this electronic transmission in error, 
please notify the original sender of this email and destroy all copies of 
this communication.

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


Thread

how do I  merg two collections? Brian O'Brien <brian.obrien@calgaryscientific.com> - 2015-01-04 22:55 -0800
  how do I  merg two collections? Lew <lewbloch@gmail.com> - 2015-01-04 23:17 -0800
  Re: how do I  merg two collections? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-05 08:57 -0500
    Re: how do I  merg two collections? BOB <brian.obrien@calgaryscientific.com> - 2015-01-05 08:38 -0800
      Re: how do I  merg two collections? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-05 11:52 -0500
  Re: how do I  merg two collections? BOB <brian.obrien@calgaryscientific.com> - 2015-01-05 13:26 -0800
    Re: how do I  merg two collections? Jeff Higgins <jeff@invalid.invalid> - 2015-01-05 17:15 -0500
    Re: how do I  merg two collections? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-05 17:35 -0500
      Re: how do I  merg two collections? Lew <lewbloch@gmail.com> - 2015-01-06 15:38 -0800
        Re: how do I  merg two collections? Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-07 13:40 +0000

csiph-web