java - combining two arraylist into a single linked list in one go -


this question has answer here:

i getting list shown below

 list<string> tr = newdatamap.get("b1").getref();  list<string> tr2 = newdatamap.get("b1").getms(); 

now can see have 2 arraylists want store contents single list itself. that:

list<string> tr = newdatamap.get("b1").gettraderef() + newdatamap.get("b1").gettms(); 

but showing error. please advise how can combine them single linked list.

if want produce new list content of tr , tr2, can try with:

list<string> list = new arraylist<>(){{ addall(tr); addall(tr2); }}; 

if want append t2 tr, can do:

list<string> tr = newdatamap.get("b1").getref().addall(newdatamap.get("b1").getms()); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -