I have 2 lists codeList
and nameList
both having String
elements.
codeList = ["1", "2", "3"];
nameList = ["One", "Two", "Three"];
I want to combine these in such a way that the elements on same index come together in resultant String
separated with |
:
"1{One} | 2{Two} | 3{Three}"
Is there any way of directly getting the resultant list or String from the 2 list itself using Java 8
I am able to achieve this by using a Map but not list.