java - combining two arraylist into a single linked list in one go -
this question has answer here:
- how join 2 lists in java? 27 answers
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
Post a Comment