For example, if I have:

mapping(address => Tickets[]) ticketEntries;

Can there me multiple tickets belonging to the same address in the ticketEntries mapping? ie:

ticketEntries[0] = (0x100..., ticket1);
ticketEntries[1] = (0x100..., ticket2);

2 Answers 2


Since you have each address mapped to an array of tickets, you should be able to do what you're trying to, but you're going about it in the wrong way.


This achieves what you want (I think) but it's not using duplicate entries in the mapping, it's simply adding multiple elements to an array. Since you are mapping addresses to arrays, you can refer to the array of Tickets associated with the address 0x100... using:


To refer to different elements in that array you can just use:



There's also an error in your example. ticketEntries[0] would be in error since 0 is not an address. So it would be ticketEntries[0x100...] = ticket.

So that said, mappings use unique keys to refer to the value. So no, there can not be duplicate values and your second assignment of ticket2 will overwrite the first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.