Q:

Generating a list with duplicate entries

How can I get a function that gives the following output?
listX = {a, b, c, d}
numberX = 3
myDuplicatesList[listX, numberX] 

{{a,a,a},{b,b,b},{c,c,c},{d,d,d}}

A:

Alternatively:
listX = {a, b, c};
numberX = 3;
Table[ConstantArray[i, numberX], {i, listX}]

{{a, a, a}, { b, b, b}, {c, c, c}}

Or:
listX = {a, b, c, d};
numberX = 3;

Transpose@Table[i, {numberX}, {i, listX}]

A:

I like using KroneckerProduct for problems like this:
KroneckerProduct[listX, ConstantArray[1, numberX]]

{{a, a, a}, {b, b, b}, {c, c, c}, {d, d, d}}

The KroneckerProduct approach should be much faster than the others for large vectors.

A:

one way might be
listX    = {a, b, c, d}
numberX  = 3
Transpose[{listX}].{Table[1, {numberX}]}

