I have two lists
List1 - (1, 2, 3)
List2 - (4, 5, 6,7, 8)
Want to merge both the list as (1, 4, 2, 5, 3, 6, 7, 8) using java streams
First element from List1, List2 and, Second element from list1, list2 ...so on..if any extra elements remain then place at the end.
Stream.concat(list1.stream(), list2.stream())
.collect(Collectors.toList())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With