How to combine two list string into one list
collections, java, list
Solution
Use Collection.addAll(), and a TreeSet, to remove duplicates and keep the result sorted.
Set<String> c = new TreeSet<String>(a); //create a Set with all the elements in a
c.addAll(b); //add all the elements in b
Problem
I have two list string different, ``` List<String> A= [1,2,3,4]; List<String> B= [1,2,5,6]; ``` And I want to combine two list, in new list string in List C = new Arraylist (); how to combine two list string , be like the example: ``` C = [1,2,3,4,5,6]; ```