I want to check branchList whether has same element or not, if same put branchList and tglList element separate arraylist and put that arraylist into another arraylist,
I didn't thoroughly read through your code (and I don't quite get what you're asking for), but if you want to merge (add the elements of) branchList
and tglList
to TglList1
, try this:
TglList1.addAll(branchList);
TglList1.addAll(tglList);
After that, TglList1
should contain all elements of both lists. If you need the list to be sorted, you might want to call Collections.sort(TglList1)
afterwards (just note that sorting strings might place "100" before "2", due to "1" being lexically smaller than "2").