# How can I union two lists in the given way?

I have two lists:

list1 = {{-21, -1}, {-19, -9}, {-19, 7}};
list2 = {{-4, -1}};


I would like to have this list

list = {{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19,7}}}


I tried

Union[list1, list2]


and got,

{{-21, -1}, {-19, -9}, {-19, 7}, {-4, -1}}


How can I get it to show this?

 list = {{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19,7}}}


Tuples[{list2, list1}]
(* {{{-4,-1},{-21,-1}},{{-4,-1},{-19,-9}},{{-4,-1},{-19,7}}} *)

Outer[List, list2, list1, 1]
(* {{{-4,-1},{-21,-1}},{{-4,-1},{-19,-9}},{{-4,-1},{-19,7}}} *)

list1 = {{-21, -1}, {-19, -9}, {-19, 7}};
list2 = {{-4, -1}};

Catenate[{list2, {#}}] & /@ list1

Join[list2, {#}] & /@ list1


Result:

{{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19, 7}}}

anther option

Given

lis1 = {{-21, -1}, {-19, -9}, {-19, 7}};
lis2 = {{-4, -1}};


Then

Map[{First@lis2, #} &, lis1]


And for fun:

Join[Riffle[lis1, lis2], lis2]
RotateLeft[#, 1] & /@ Partition[%, 2]


l1 = {{-21, -1}, {-19, -9}, {-19, 7}};

l2 = {{-4, -1}};

l3 = {{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19, 7}}};


Using Thread:

Activate[Reverse /@ Thread[{l1, Inactive[l2[[1]]]}]] === l3

(*True*)


Or using Replace at level 1:

Replace[l1, {a_, b_} :> l2~Append~{a, b}, {1}] === l3

(*True*)


Distribute[{list2, list1}, List] == list

True

Thread[{list2[[1]], list1}, List, {2}] == list

True

a = {{-21, -1}, {-19, -9}, {-19, 7}};

b = {{-4, -1}};

SequenceCases[Riffle[a, b, {2, -1, 2}], {a_, b_} :> {b, a}]


{{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19, 7}}}

Distribute[{list2, list1}, List]

(* {{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19, 7}}} *)


or

MapApply[{list2[[1]], {##}} &, list1]

(* {{{-4, -1}, {-21, -1}}, {{-4, -1}, {-19, -9}}, {{-4, -1}, {-19, 7}}} *)