Ragged Transpose
L1 = {1, 2, 3};
L2 = {{x}, {y1, y2}, {z}};
Flatten[Thread /@ Transpose @ {L1, L2}, 1]
{{1, x}, {2, y1}, {2, y2}, {3, z}}
replacing Flatten
with Join
looks a bit nicer (tip of the hat to @HenrikSchumacher):
Join @@ Thread /@ Transpose @ {L1, L2}
And if you assume that L1 == Range[Length[L2]]
as specified, then you could also do this (tip of the hat to @MikeY):
Reverse /@ Flatten[MapIndexed[Outer[List, ##] &, L2], 2]
Alternatively:
L1 = {1, 2, 3};
L2 = {{x}, {y1, y2}, {z}};
Module[{tmp = L2}, tmp[[All, All]] = L1;
Flatten[{tmp, L2}, {{2, 3}, {1}}]]
{{1, x}, {2, y1}, {2, y2}, {3, z}}
L1 = {1, 2, 3};
L2 = {{x}, {y1, y2}, {z}};
Join @@ MapThread[Thread[{#1, #2}] &, {L1, L2}]
{{1, x}, {2, y1}, {2, y2}, {3, z}}