I have an array tab1 that contains some strings and another array that could contains all element of array tab1.
how do I can do this to avoid repeating same element of tab1 :
String[] tab1 ={"AF","HB,"ER"}
String[] tab2 ={"AF","HB,"ER","HO","NF","BB","CD","PO"}
I would like to say : tab2 = {tab1,”HO”,…}
any idea ?
thanks,
You might want to use Arrays.copyOf() to create an array of size tab1.length + 5, which starts with the elements of tab1, and then add [manually] elements of tab2
Simple example:
[of course if you have the later elements in a third array you can iterate and add them]