We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Combine two arrays with no duplicates
Page Index Toggle Pages: 1
Combine two arrays with no duplicates (Read 1318 times)
Combine two arrays with no duplicates
Dec 12th, 2009, 4:36pm
 
Lets say I have
array1 {a,b,c,d,e}
array2 {b,c,d,e,f,g}

What is the best way to combine these two arrays into one with no duplicates?
array 3 {a,b,c,d,e,f,g}
Re: Combine two arrays with no duplicates
Reply #1 - Dec 13th, 2009, 2:01am
 
Are both arrays sorted? Or do the elements have a random order?
Re: Combine two arrays with no duplicates
Reply #2 - Dec 13th, 2009, 5:10am
 
They're random..
Re: Combine two arrays with no duplicates
Reply #3 - Dec 13th, 2009, 10:31am
 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html

From the documentation: "A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element."
Page Index Toggle Pages: 1