Java: combine collection lists, doubles only [duplicate]

This question already has an answer here:

Union and intersection of java Sets

2 answers

I have 2 collection lists in Java.

List a = new ArrayList () {{ add ("1"); add ("2"); add ("6"); }};

List b = new ArrayList () {{ add ("6"); add ("8"); add ("9"); }};

If I need a combined list that has the elements of both lists without doubles

I would put the list-elements in a hash (element = hash key) and then iterate over the hashs key. That would eliminate the doubles.

Now I need the combination for just...

Read More »

By: StackOverFlow - Tuesday, 6 November

Related Posts